[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Problem: Create a Access table by TQuery

Posted on 2002-07-18
4
Medium Priority
?
225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

649 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