A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old February 25th, 2005, 07:04 PM
KhalilS
external usenet poster
 
Posts: n/a
Default how do you create an auto number field in Access using DDL?

how do you create an auto number field in Access using DDL? the Auto things
it an Auto..!
  #2  
Old February 25th, 2005, 08:54 PM
Chris2
external usenet poster
 
Posts: n/a
Default


"KhalilS" wrote in message
...
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.


  #3  
Old February 28th, 2005, 12:40 PM
Jamie Collins
external usenet poster
 
Posts: n/a
Default


Chris2 wrote:
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.

--

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I number and rank records in Access, based on another field Heather New Users 1 February 24th, 2005 03:42 AM
incorrect sums in report using 2 tables jkendrick75 Setting Up & Running Reports 22 December 13th, 2004 03:19 PM
Access: How can I generate an auto number for each record in a ta. TerryGB Running & Setting Up Queries 1 November 2nd, 2004 01:38 PM
Images in a database Franz General Discussion 10 October 7th, 2004 09:35 AM
Auto Number part of a field MDW Running & Setting Up Queries 1 October 1st, 2004 12:13 PM


All times are GMT +1. The time now is 09:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.