首页 > 代码库 > SET IDENTITY_INSERT 表名 ON

SET IDENTITY_INSERT 表名 ON

SET IDENTITY_INSERT products ON

insert into products(pid,pname) values (1,‘pname1‘);

insert into products(pid,pname) values (2,‘pname2‘);

insert into products(pid,pname) values (3,‘pname3‘);

SET IDENTITY_INSERT products OFF

 

这样就能插入标识列

 

SET IDENTITY_INSERT 表名 ON