Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 create auto ID

Author  Topic 

bootsy
Starting Member

7 Posts

Posted - 2008-03-04 : 16:34:17
I created a table with a field called myID. I set the data type as "uniqueidentifier", but it won't auto generate. How do I create a field to auto generate a unique number? I'm working with SQL Server 2000 and I'm creating the table from Enterprise Manager.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-03-04 : 16:35:44
Why not use an identity column instead?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

jdaman
Constraint Violating Yak Guru

354 Posts

Posted - 2008-03-04 : 16:36:06
CREATE TABLE TableName ( myID INT IDENTITY(1, 1), ... )
Go to Top of Page

bootsy
Starting Member

7 Posts

Posted - 2008-03-04 : 16:57:04
That's what I would like to do is create an identity column but I don't know how. Is this done in the properties of the column. I'm so lost.

jdaman .. where would I put that statement?
Go to Top of Page

bootsy
Starting Member

7 Posts

Posted - 2008-03-04 : 17:04:54
Thanks guys. I figured it out. I didn't know that the "INT" data type would give me that option. thanks so much.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-04 : 18:23:03
Or bigint, tinyint or smallint.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -