|
Posted by Erland Sommarskog on 11/28/06 08:06
Jim C (jim.cullison@gmail.com) writes:
> Is there an equivalent in mssql to SQL Anywhere's GET_IDENTITY which
> reserves the next autoinc value for a table? Yes I know about
> @@Identity and SCOPE_IDENTITY. I need to get the next autoinc value
> _before_ I insert the record due to the way the existing application
> works.
The function ident_current() is the one you are looking for, but the value
it returns is global to all processes, so if you call ident_current(),
insert a row and then look at scope_identity() you may see a different
value, if another process was at it at the same time.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|