Solved

Problem: Create a Access table by TQuery

Posted on 2002-07-18
4
218 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

27 Experts available now in Live!

Get 1:1 Help Now