Cannot insert explicit value for identity column into table if IDENTITY_INSERT is set to OFF

I am trying to import records from an old database into a new clean database database. I installed a new database to have the basic IDENTITY keys, however I want to insert the same values ​​as the original database.

in SQL I did:

set IDENTITY_INSERT plans on

I am using LINQ to SQL, and I have disabled auto-generated columns, but I still get this error:

Cannot insert explicit value for identity column in table 'Plans' when IDENTITY_INSERT is set to OFF.

but he is on

+3
source share
1 answer

The parameter identity_insertis local to the database session. You must use the same database connection when you install it, as when pasting.

+3
source

All Articles