Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Ultimo ID inserito di MS SQL Server

Prova questo -

DECLARE @ID BIGINT

INSERT INTO dbo.TABLE_ID (Table_NAME) 
SELECT 'Table_Products'

SELECT @ID = SCOPE_IDENTITY()

INSERT INTO dbo.Table_Products (ID, Product_Name)
SELECT @ID, 'SomeProduct'