Create Table with Default Values

A

aMoL

I am not able to Add default values using the Create Table
syntax. Can any one help me out the situation.

aMoL
 
A

Allen Browne

If you are talking about CREATE TABLE in DDL (SQL statement) executed under
ADO, you can specify a literal value for the DEFAULT of the column, e.g.:
Amount CURRENCY DEFAULT 0

If you are talking about the CreateTable() method in DAO, you will need to
CreateProperty() and Append it after creating the field/table. Using this
approach you can provide expressions such as:
=Date()
 
T

Tim Ferguson

I am not able to Add default values using the Create Table
syntax. Can any one help me out the situation.

There is more than one dialect of SQL that can be passed to Jet, and they
differ in some aspects, particularly some of the less common ones, like
DEFAULT.

As Allen points out, if you use the ADO conn.Execute method, you get Jet 4,
which does allow it.

If you are using DAO CurrentDB().Execute, then you get Jet 3.6, which
doesn't. Yes it would be good if MS would bring out a Jet 3.62 with the
updated SQL, but I would not bet on it.

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top