select @@IDENTITY -- returns the last IDENTITY value produced on a connection
select IDENT_CURRENT('tableName') -- returns the last IDENTITY value produced in a Table
select Scope_IDENTITY() -- returns the last IDENTITY value produced on a connection
Example
insert into Emp values('patel',700)
select @@IDENTITY
-- or ---
select scope_identity()
-- or --
select IDENT_CURRENT('Emp')This code snippet for retrieving the current inserted identity id from table.
