Posted by john on 03/21/06 18:03
Hi there
I have small problem with IDENT_CURRENT...
We have a table where PK is generated automatically.
What I want is to get that value and insert it to another,
corresponding table.
So here is what I am doing...
BEGIN TRAN
Insert Into table() --> PK is created.
SELECT IDENT_CURRENT('Table_Name') AS lastValue
COMMIT TRan
IT works fine, but there is a possibility to insert another record by
another user before I get my IDENT_CURRENT.
For instance:
BEGIN TRAN
Insert Into table() --> PK is created.
---->somebody else inserts another record into same table.
SELECT IDENT_CURRENT('Table_Name') AS lastValue
---->this is not the value that I generated....
COMMIT TRan
[Back to original message]
|