Search notes:

SQL Server: scope_identity(), @@identity and ident_current

scope_identity(), @@identiy and ident_current(table_name) can be used to obtain the value that was inserted into a identity column.

See also

Automatically insert primary key id with IDENTITY columns

Index