how do you create an auto number field in Access using DDL?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do you create an auto number field in Access using DDL? the Auto things
it an Auto..!
 
KhalilS said:
how do you create an auto number field in Access using DDL? the Auto things
it an Auto..!

Example:

CREATE TABLE Policies
(policy_id AUTOINCREMENT
,policy_start_date DATETIME
,policy_renewal_date DATETIME
,premium_payable CURRENCY
,other_policy_details TEXT(255)
,CONSTRAINT pk_Policies PRIMARY KEY (policy_id)
)


Sincerely,

Chris O.
 
Chris2 said:
CREATE TABLE Policies
(policy_id AUTOINCREMENT
,policy_start_date DATETIME
,policy_renewal_date DATETIME
,premium_payable CURRENCY
,other_policy_details TEXT(255)
,CONSTRAINT pk_Policies PRIMARY KEY (policy_id)
)

FWIW I prefer the synonym IDENTITY i.e. the same for SQL Server. Also,
you can explicitly specify the data type plus the seed and increment
values e.g. could make your column definition clearer with:

policy_id INTEGER IDENTITY (1,1) NOT NULL

Jamie.

--
 

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

Back
Top