Top "Identity-insert" questions

`IDENTITY_INSERT` is a Sql Server database option which permits values for an identity column on a table to be explicitly specified during an Insert operation.

How do you check if IDENTITY_INSERT is set to ON or OFF in SQL Server?

I've searched for this, but threads in which it appeared tended to have answers from people who didn't understand the …

sql sql-server identity-insert
SqlBulkCopy Insert with Identity Column

I am using the SqlBulkCopy object to insert a couple million generated rows into a database. The only problem is …

c# sql-server sqlbulkcopy identity-insert
script to add and remove auto-increment property from a column

For a sql script I'm working on, I need to programmatically remove the identity, identity seed, and identity increment for …

sql-server identity-insert
IDENTITY INSERT and LINQ to SQL

I have a SQL Server database. This database has a table called Item. Item has a property called "ID". ID …

c# .net linq-to-sql identity-insert
How to automatically reseed after using identity_insert?

I recently migrated from a PostgreSQL database to a SQL Server database. To switch the data over I had to …

sql-server identity identity-insert
How to put SET IDENTITY_INSERT dbo.myTable ON statement

What I need to do is have a SET IDENTITY_INSERT dbo.myTable ON statement, what's the syntax of using …

c# sql-server identity-insert
Linq to SQL: Why am I getting IDENTITY_INSERT errors?

I'm using Linq to SQL. I have a DataContext against which I am .SubmitChanges()'ing. There is an error inserting …

c# linq linq-to-sql identity-insert
Why does this EF insert with IDENTITY_INSERT not work?

This is the query: using (var db = new AppDbContext()) { var item = new IdentityItem {Id = 418, Name = "Abrahadabra" }; db.IdentityItems.Add(item); …

c# entity-framework entity-framework-6 identity-insert
Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF

I'm trying to insert records in a table that has got an identity column. For various reasons, this should not …

sql insert identity-insert
Using IDENTITY_INSERT with EF4

I am trying to create a record in the db that has a predefined primary key value. I know how …

entity-framework identity-insert