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)
 Retrieving row id on insert

Author  Topic 

Anna
Starting Member

20 Posts

Posted - 2001-03-16 : 03:31:08
When I insert values into a table with an identity seed as the primary key, is there any way of retrieving the new row id other than doing a seperate select eg.

insert into table1 (col1,col2) values('a','b')
select max(pk_idno) from table1

If I do have to do it this way, will this always return the correct result, even when multiple users might be updating the database simultaneously?
Thanks!

Anna
   

- Advertisement -