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

How do use Having,Group by,Group function in SQL?

0 Answers  


Diffrences between sql server 2000 vs 2008

0 Answers   TCS,


What is sub query and its properties?

0 Answers  


What is lock escalation?

1 Answers  


Explain cdc and sql injection?

0 Answers  






How to update existing rows in a table?

1 Answers  


How to check what was the last restore transaction LSN on Log-Shipping and Mirroring when we doesn't have a Monitor server and Witness server?

2 Answers   IBM,


How you can add messages to the nt event log from within a stored procedure?

0 Answers  


How many .ndf files can we create in Sql server 2005?

2 Answers   Wipro,


How many full-text indexes can a table have?

0 Answers  


What is difference between delete & truncate commands?

0 Answers  


What is difference between cte and view?

0 Answers  


Categories