Access 2003 CREATE TABLE - default value and Boolean field formats

PAB

New member
Local time
Today, 00:32
Joined
Apr 16, 2008
Messages
3
I'm using a series of SQL commands (being executed from a legacy ASP script) to create some tables in an access 2003 database.

I have got as far as creating my tables and constraints using 'CREATE TABLE' but due to the lack of documentation on msdn, i'm struggling to configure some of the more specific field options.

Firstly, I'd like to be able to set a 'Default Value' for a Date field.

Secondly, When creating boolean (BIT) fields in Access itself, there is an option to set the 'Format' for the field, whereby you can set it to True/False.
I'd like to be able to set this from my CREATE TABLE statement rather than having the standard -1/0 values.

I've searched high and low and haven't been able to find any documentation for either of these issues.

Any help/guidance would be much appreciated.
 
I couldn't find anything about a 'bump' policy so hope nobody minds..

I've still had no luck with this, I'm not one to give up easily but have still found nothing.

I find it difficult to belive that it just isn't possible!
 
I couldn't find anything about a 'bump' policy so hope nobody minds..

I've still had no luck with this, I'm not one to give up easily but have still found nothing.

I find it difficult to belive that it just isn't possible!

To set a default value in Access SQL, you need to use a seperate query from the CREATE TABLE statement.

Use

Code:
ALTER TABLE [TableName] ALTER COLUMN [ColumnName] COLUMNTYPE DEFAULT DefaultValue

COLUMNTYPE would be Date, Text, Long, or whatever the data type is.

I don't know of anyway to set the format for the boolean fields in the table, if it is important that it show true/false I'd create a select query and format the data there.
 
To set a default value in Access SQL, you need to use a seperate query from the CREATE TABLE statement.

Use

Code:
ALTER TABLE [TableName] ALTER COLUMN [ColumnName] COLUMNTYPE DEFAULT DefaultValue

COLUMNTYPE would be Date, Text, Long, or whatever the data type is.

I don't know of anyway to set the format for the boolean fields in the table, if it is important that it show true/false I'd create a select query and format the data there.

Thank you for the help with the default value.

The boolean field format would have been nice but I can live without - It just makes it a little more user friendly to have a checkbox rather than the raw 0/-1.

Many thanks,
P
 

Users who are viewing this thread

Back
Top Bottom