Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get the last identity value for a table?
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01421835
Message ID:
01421845
Views:
56
This message has been marked as a message which has helped to the initial question of the thread.
>>It's not the last value in the IDENTITY column but the last IDENTITY value generated for a specified table. To get the last value in the column you'll have to run a query with MAX() on that column.
>
>I get it. I only use IDENTITY for a PK column so in my case I have only one IDENTITY per table. In this case doing MAX() on the column and IDENT_CURRENT would give the same result, right?

First, you can have only one IDENTITY column per table.
They may not. The next IDENTITY value is generated outside of any transaction. If the transaction that causes next value to be generated is rolled back than that value will not make it in the table.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform