SQL Server Identity Column

  1. select @@IDENTITY -- returns the last IDENTITY value produced on a connection  
  2. select IDENT_CURRENT('tableName'-- returns the last IDENTITY value produced in a Table  
  3. select Scope_IDENTITY() -- returns the last IDENTITY value produced on a connection  
  4. Example    
  5.    
  6. insert into Emp values('patel',700)  
  7. select @@IDENTITY  
  8. -- or ---  
  9. select scope_identity()  
  10. -- or --  
  11. select IDENT_CURRENT('Emp')