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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: Autonumbering & Identity Columns
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

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.

Posting Yak Master

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

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  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000