IDENTITY_INSERT

设定 SET IDENTITY_INSERT
建立一个有标识列的表:
CREATE TABLE products (id int IDENTITY PRIMARY KEY, product varchar(40))
尝试在表中做以下操作:
INSERT INTO products (id, product) VALUES(3, 'garden shovel')
结果会导致错误
改用:
SET IDENTITY_INSERT products ON
INSERT INTO products (id, product) VALUES(1, 'garden shovel')
返回正确。

你可能感兴趣的:(职场,休闲,IDENTITY_INSERT)