BUG: Identity field remains read-only after executing SET IDENTITY_INSERT ON statement
Symptoms
Identity columns are normally read-only because the server generates the values. However, when you migrate data from one table to another you often want to keep the existing Identity column values rather than use server-generated values. Microsoft SQL Server 7.0 allows you to do this with the SET IDENTITY_INSERT ON statement.
This operates correctly when you use INSERT INTO SQL statements. However, when you insert records through the AddNew method of an ActiveX Data Objects (ADO) Recordset, you receive the following error:
Run-time error ‘-2147217887 (80040e21)’
Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
Resolution
The Microsoft SQL Server 7.0 OLE DB provider incorrectly reports to ADO that the Identity column is read-only.

Leave a Reply