Wednesday, August 17, 2011

IDENT_CURRENT–Retrieve last inserted identity of record

SELECT IDENT_CURRENT(‘<tablename>’)


It returns the last IDENTITY value produced in a table, regardless of the connection that created the value, and regardless of the scope of the statement that produced the value.
IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope.

Happy Coding…