SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Auto-incrementing a field
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

llzamboni
Starting Member

5 Posts

Posted - 11/09/2006 :  17:02:12  Show Profile  Reply with Quote
I am porting a database from Informix to SQL Server 2000. Several fields in the informix database are specified as SERIAL, which means that they auto-increment auto-magically if you insert a 0 into them. Well...I was looking for an equivalent in SQL Server 2000, and thought I had found it in the IDENTITY column concept.

With further investigation into IDENTITY columns, however, I discovered that only one column per table can be given the IDENTITY property. Why is this? Is there a way around that? If not, is there another way to achieve this feature in SQL Server 2000? If not, any suggestions on how I can do it?

Thanks!

Lisa

spirit1
Cybernetic Yak Master

Slovenia
11751 Posts

Posted - 11/09/2006 :  17:04:11  Show Profile  Visit spirit1's Homepage  Reply with Quote
only one column per table can be set as identity.

you can also achieve this behavior with after insert triggers.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

llzamboni
Starting Member

5 Posts

Posted - 11/09/2006 :  17:12:05  Show Profile  Reply with Quote
Could you elaborate on how an after insert trigger might look?
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 11/09/2006 :  17:51:54  Show Profile  Reply with Quote
This discussion seems to have been continued in the cross posted version :)
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74721&

Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000