SQL Server: Retrieve auto-incremented ID inside a stored procedure?
You can retrieve it from SCOPE_IDENTITY(). For example:
declare @myid int
INSERT INTO table (field) VALUES ('value')
SELECT @myid = SCOPE_IDENTITY()
You can retrieve it from SCOPE_IDENTITY(). For example:
declare @myid int
INSERT INTO table (field) VALUES ('value')
SELECT @myid = SCOPE_IDENTITY()