How to Get the last identity value used

Answers were Sorted based on User's Feedback



How to Get the last identity value used..

Answer / laxman

select @@identity

@@identity is global variable

Is This Answer Correct ?    4 Yes 0 No

How to Get the last identity value used..

Answer / guest

the last identity value used in an insert can be retrieved
with the @@identity function.

Is This Answer Correct ?    3 Yes 0 No

How to Get the last identity value used..

Answer / j.m.

dbcc checkident(table)

Is This Answer Correct ?    1 Yes 0 No

How to Get the last identity value used..

Answer / chandramohan

scope_identity() would be the currect answer. To avoid potential problems professionals suggests this method since it returns the recently added value.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More SQL Server Interview Questions

What are different types of join?

0 Answers  


how many clustered indexes can be created on a table? : Sql server database administration

0 Answers  


how to write the query to select the rows are in the order of either 1,3,5,7... or 2,4,6,8,...

7 Answers   ADP, Satyam, Tech Mahindra,


Why use “nolock” in sql server?

0 Answers  


How do database indexes work?

0 Answers  






What is database mirroring?

0 Answers  


How to get last system shutdown time in Sql server when restarted system?

1 Answers  


How to add an address record into adventureworkslt?

0 Answers  


what is for foreign key ??

4 Answers   CarrizalSoft Technologies, Sabic,


What is acid mean in sql server?

0 Answers  


When would you use a before or after trigger?

0 Answers  


What are statistics?

0 Answers  


Categories