|
Posted by David Portas on 11/28/06 00:18
Jim C wrote:
> 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.
>
> I've seen DBCC CHECKIDENT mentioned but that seems kludgy to me.
>
> TIA,
> Jim
You cannot reliably determine the next IDENTITY value, except maybe in
a single user system. There are other ways however:
http://www.sqlmag.com/Article/ArticleID/48165/sql_server_48165.html
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Navigation:
[Reply to this message]
|