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
 autogenerated id help

Author  Topic 

my_aro
Yak Posting Veteran

50 Posts

Posted - 2005-09-13 : 01:23:44
can anybody tell me how to have an autogenerated id in sql server? pls?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-13 : 01:33:23
Use Identity

Create table yourTable (i int identity(1,1),name varchar(100))

Now i is an autogenerated id

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-14 : 06:03:32
Hi jayson,

are you referring to uniqueidentifier or an auto incremental ID (identity), you can also create your own autogeneration through an insert trigger or calling an sproc to generate the ID before saving the record...

sorry i was out, took a much needed VL

HTH

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -