How you can get the last identity value inserted in any table ?

 Posted by Neeks on 3/5/2009 | Category: Sql Server Interview questions | Views: 10402
Answer:

SQL Server 2000 has a System Variable @@IDENTITY which gives the last identity element value inserted in any table


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Vuyiswamb on: 3/31/2009
The @@IDENTITY will not always bring you the last inserted identity Column. The one way that will surely bring you the last identity value is like this

select IDENT_CURRENT ('mytable')

Login to post response