在此记录备忘。
CREATE TABLE tb_test(custid INT IDENTITY(1,1) NOT NULL , name nvarchar(200) NOT NULL) DECLARE @cid TABLE(cid INT) DECLARE @c2 INT INSERT INTO tb_test(name) OUTPUT INSERTED.custid INTO @cid VALUES('a') SELECT * FROM @cid c DROP TABLE tb_test
在此记录备忘。
CREATE TABLE tb_test(custid INT IDENTITY(1,1) NOT NULL , name nvarchar(200) NOT NULL) DECLARE @cid TABLE(cid INT) DECLARE @c2 INT INSERT INTO tb_test(name) OUTPUT INSERTED.custid INTO @cid VALUES('a') SELECT * FROM @cid c DROP TABLE tb_test