?
Solved

Problem: Create a Access table by TQuery

Posted on 2002-07-18
4
Medium Priority
?
224 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

764 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