Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我收到错误消息“当 IDENTITY_INSERT 设置为 OFF 时,无法在表‘表’中插入标识列的显式值。”
该表有两个主键,一个设置为自动递增,一个设置为 i 传入的值。
这在 SQL Server 2005 中可行吗?还是我错过了什么?
提前非常感谢。
您正在尝试将值插入标识列您可以通过以下方式执行此操作
SET IDENTITY_INSERT TableName ON INSERT INTO TableName() VALUES () SET IDENTITY_INSERT TableName OFF
http://msdn.microsoft.com/en-us/library/ms188059.aspx