Use @@IDENTITY (Transact-SQL).
Example:
INSERT INTO Production.Location (Name, CostRate, Availability, ModifiedDate)
VALUES ('Damaged Goods', 5, 2.5, GETDATE());
GO
SELECT @@IDENTITY AS 'Identity';
See the following link for more details:
http://msdn2.microsoft.com/en-us/library/ms187342.aspx
- A.Kahtava