How can I get the next autoincrement value from mssql$sqlexpress?

  • Thread starter Thread starter Carlos
  • Start date Start date
This can be done by :-

using @@IDENTITY which returns the last-inserted identity value

But the preferable solution is to use IDENT_CURRENT('TableName') which
returns the last identity value generated for a specified table in any
session and any scope.
 
tirrell said:
This can be done by :-

using @@IDENTITY which returns the last-inserted identity value

But the preferable solution is to use IDENT_CURRENT('TableName') which
returns the last identity value generated for a specified table in any
session and any scope.

I find it very rare that this is what is needed.

@@IDENTITY or SCOPE_IDENTITY() is usually what
is needed.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top