Solved

Problem: Create a Access table by TQuery

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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