To create a primary key create a unique clusted index after you have crated
the table like so....

CREATE TABLE <table name>
(       field1 int PRIMARY KEY CLUSTERED
,       field2 datetime DEFAULT GETDATE()
,       field3......
..
..
..
)
  
The other way is to creat the table and then create an unique clustered
index index afterwards to create the primary key and then perform an alter
table statement to set the default.

hope that helps

Andy


------------------------------------------------------------------ 
Andrew Ewings
Project Manager
Thoughtbubble Ltd 
http://www.thoughtbubble.net 
------------------------------------------------------------------ 
United Kingdom 
http://www.thoughtbubble.co.uk/ 
Tel: +44 (0) 20 7387 8890 
------------------------------------------------------------------ 
New Zealand 
http://www.thoughtbubble.co.nz/ 
Tel: +64 (0) 9 419 4235 
------------------------------------------------------------------ 
The information in this email and in any attachments is confidential and
intended solely for the attention and use of the named addressee(s). Any
views or opinions presented are solely those of the author and do not
necessarily represent those of Thoughtbubble. This information may be
subject to legal, professional or other privilege and further distribution
of it is strictly prohibited without our authority. If you are not the
intended recipient, you are not authorised to disclose, copy, distribute, or
retain this message. Please notify us on +44 (0)207 387 8890. 



-----Original Message-----
From: ibtoad [mailto:[EMAIL PROTECTED]]
Sent: 03 November 2000 14:13
To: CF-Talk
Subject: Create Table SQL


I have 2 questions, I am writting an CREATE Table SQL statement for MS
Access,

How do I create the table to have a primary key?

What statement do I use to create a date field with default Date()?

Thanks,
Rich

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to