SQL Server 2008 R2 x64 下
事情是这样的, 使用Navcate的数据导出备份工具导出表的记录
INSERT INTO [xxx_users] VALUES (1, ‘tom ‘, ‘[email protected] ‘, ‘13432145689 ‘, ‘ ‘, ‘浜屽疂 ‘, NULL); GO INSERT INTO [xxx_users] VALUES (2, ‘zj_a ‘, NULL, NULL, ‘e10adc3949ba59abbe56e057f20f883e‘, NULL, NULL); GO
因为 [xxx_users]表有一列是自增长的标识列,所以当执行上面的SQL是报错的,提示 IDENTITY_INSERT 为 ON 之类的
解决方法参考
set identity_insert [xxx_users] OFF INSERT INTO [xxx_users] VALUES (‘tom‘, ‘[email protected]‘, ‘13432145689‘, ‘‘, ‘浜屽疂‘, NULL); GO INSERT INTO [xxx_users] VALUES (‘zj_a‘, NULL, NULL, ‘e10adc3949ba59abbe56e057f20f883e‘, NULL, NULL); GO set identity_insert [xxx_users] ON
时间: 2024-10-19 18:13:04