这是更改了表的设置
set IDENTITY_INSERT tablename OFF ;//不可以插入主键
set IDENTITY_INSERT tablename ON ;//可以插入主键,并且主键可以重复
//恢复完数据后再改回off状态,保持主键自增且不重复
举例
SET IDENTITY_INSERT comment ON
insert into comment(id,content,createTime ,userIp,newsId) values
(‘1’,’zzsdhf’,2014-10-12,12,4)
SET IDENTITY_INSERT comment off