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
 Article: Autonumbering & Identity Columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 07/02/2000 :  00:00:00  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
John writes "I'd like to be able to automatically number each row as it comes into the table. Is possible to do this? How do I know what the value of the row I just inserted is?"

Article Link.

JohnDeere
Posting Yak Master

USA
191 Posts

Posted - 07/06/2000 :  15:34:14  Show Profile  Reply with Quote
Identity Columns

If you want the identity of each row to be unique, you need to create a unique index or primary key constraint on the identity column.

Go to Top of Page

Anonymous
Starting Member

0 Posts

Posted - 08/01/2000 :  03:13:21  Show Profile  Reply with Quote
@@identity and triggers

@@IDENTITY will give you the identity value for the last row inserted. This is fine unless the table you're inserting into has a trigger which performs an insert of its own generating another identity. How can you solve this, since you're interested in retrieving the ID for the first table?

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.05 seconds. Powered By: Snitz Forums 2000