enquires@blushmedia.co.uk
 

Scope_Identity();

Menu

Set the last inserted Id to a variable so it can be used again

 

  
DECLARE @LastInsertedId int  
INSERT INTO Table (Name, Surname) VALUES (’Mike’,’Smith’);  
SET @LastInsertedId = Scope_Identity();