我正在尝试使用VBA从文本文件重建数据库。为了插入ID值,在发送INSERT之前,我调用了以下代码:
SET IDENTITY_INSERT TableName ON
这对大多数TableNames似乎工作正常,但是当我在表 'Accounts' 上调用它时,我会得到一个有趣的错误:
"IDENTITY_INSERT is already ON for table 'test.dbo.PropertyAssets'. Cannot perform SET operation for table 'Accounts'."
我猜这可能与fkey约束有关,但有没有人确定的?
PropertyAssets
的标识插入,但从未关闭它。 - user330315