Solved

Problem: Create a Access table by TQuery

Posted on 2002-07-18
4
217 Views
Last Modified: 2010-04-04
How to define a field's default value? (MS Access DB)

with TQuery1 do begin
  SQL.Clear;
  SQL.Add('CREATE TABLE Table1 (');
  SQL.Add('AName varchar(10) NULL,');
  SQL.Add('Value int NULL');  // <- how to define it's default value?
  SQL.Add(')');
  ExecSQL;
end;

Thanks in advance!
0
Comment
Question by:sysu
  • 2
4 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7161724
?
a null must not defined, its a default,
if nothing oither is given

Create Table abc (
  AName CHAR(20) DEFAULT "X"
 ,Value INT DEFAULT 1
  )

not tested, just from head

meikl ;-)

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7161733
sorry, you can't set defaults with jet-SQL :-(
0
 
LVL 2

Accepted Solution

by:
mikepj earned 100 total points
ID: 7166143
I use the BDE replacement Opus Direct Access (www.opus.ch) for my Access work.  With that I can create/delete relations, set defaults, set anything I've ever wanted to be able to create or restructure.  And BTW, it's free and open-source.  I can provide examples.
0
 

Author Comment

by:sysu
ID: 7170811
Thanks mikepj, Opus DirectAccess is not bad, I have replaced the BDE by ODA. ;-)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Firewall issues 6 85
System restore point 4 77
Delphi Form ownership 4 50
Need Help Delphi 2010 CheckBox1 Stored value in memo 13 14
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now