@@IDENTITY (TSQL Function)

Returns the last value inserted in the IDENTITY column of a table by INSERT statement (even caused by procedure, trigger, or user defined function) in the current batch.



Return Types

Returns bigint.


This function is similar to SCOPE_IDENTITY, but has some caveats (see documentation of SCOPE_IDENTITY).

You should always use SCOPE_IDENTITY instead of @@IDENTITY.

RSQL, a simple alternative to Microsoft SQL Server