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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How do I trap an identity value

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-08-26 : 07:07:28
Nielen writes "I use SQL to INSERT a new row in a SQL Server table and it now has an automatically-allocated Row ID, which I don'tknow the value of. The two obvious solutions are:
1. use a table of control numbers and allocate new Row IDs myself
2. flag the newly INSERTed row using a special field and re-SELECT it after the INSERT to get the Row ID

...neither of which are as elegant as being able to detect what the newly-allocated Row ID is when it is created.

Any tricks or ideas?. IS there a way of getting the Row ID from a variable somewhere in SQL Server? Any help much appreciated."

   

- Advertisement -