Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default values in SQL

Status
Not open for further replies.

gilliand

Programmer
Dec 21, 2000
1
GB
I am trying to create a table using SQL in access. I want one of the columns to have s default value, how is this done?

CREATE TABLE Bus (BugID INTEGER, Bug_Type CHAR(1) DEFAULT = 'C', Date_Entered DATE DEFAULT = Date());

This doesn't work but I want it to, how can I do this?

Thanks a lot!
Gillian
 
I am not aware of the capability of defining a default value to a field via SQL. If you lookup default value property in Ms. Access help you can see how Ms. Access code can be set up to do the default value when generating a table via the create table/append field methods. It also requires that a default value property be appended to the field while the table/fields are being created.

I know this is not what you are loking for, but the actual implementation of the create table process is not so hard. I have set up tables of tables; Fields; Indicies; and Descriptions, then looped through the tables to create the a database and implement the tables with the attributes I wanted. I never actually got around to doing alterations through this approach, but even that is possible using the tabledef object.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top