identity-insert Questions
11
I made a few tables in EF and entered in some seed data where I give value to a few columns with a primary key. When I run the application I am getting the error message:
Cannot insert expl...
Crypt asked 30/11, 2016 at 18:54
9
Solved
I am using the SqlBulkCopy object to insert a couple million generated rows into a database. The only problem is that the table I am inserting to has an identity column. I have tried setting the Sq...
Repossess asked 11/7, 2011 at 14:38
5
Solved
I recently migrated from a PostgreSQL database to a SQL Server database. To switch the data over I had to enable IDENTITY_INSERT. Well come to find out that I get all sorts of strange errors due to...
Homicidal asked 27/5, 2010 at 18:35
8
Solved
This is the query:
using (var db = new AppDbContext())
{
var item = new IdentityItem {Id = 418, Name = "Abrahadabra" };
db.IdentityItems.Add(item);
db.Database.ExecuteSqlCommand("SET IDENTITY_I...
Penmanship asked 2/2, 2017 at 6:23
1
We are migrating to SQL Server 2019 RTM version and noticed that one of our stored procedures that uses SET IDENTITY_INSERT ON/OFF statements are failing which works properly in SQL Server 2017 and...
Dervish asked 15/11, 2019 at 17:8
8
Solved
I've searched for this, but threads in which it appeared tended to have answers from people who didn't understand the question.
Take the following syntax:
SET IDENTITY_INSERT Table1 ON
How do ...
Vulgarian asked 17/5, 2012 at 14:45
7
Solved
I'm using Linq to SQL. I have a DataContext against which I am .SubmitChanges()'ing. There is an error inserting the identity field:
Cannot insert explicit value for identity column in table 'Rigs...
Protoactinium asked 12/3, 2009 at 2:1
1
Solved
I am migrating a legacy database to a new database which we need to access and "manage" (as oxymoronic as it might sound) primarily through Entity Framework Code-First.
We are using MS SQL Server ...
Monamonachal asked 14/8, 2014 at 21:21
6
Solved
I have a SQL Server database. This database has a table called Item. Item has a property called "ID". ID is the primary key on my table. This primary key is an int with an increment value of 1. Whe...
Croissant asked 26/5, 2011 at 13:20
3
Solved
I'm trying to grab thousands of invoices (and other stuff) from a text file and insert them into SQL Server 2008. I wrote a little console app to do this and it uses LINQ to SQL. After I insert all...
Derail asked 30/12, 2009 at 0:45
1
Solved
We run a Spring 3.1/Hibernate 4/Java 7/Tomcat 7/MSSQL 2008 R2 web application. We must deal with legacy data and archived data. When extracting data from an archive, we have a need to use the origi...
Emrick asked 16/10, 2012 at 18:54
1
Solved
Case
Currently I'm working on database seeding script, executed with sqlcmd. For example this script sample:
IF (SELECT COUNT(*) FROM Genders)=0
BEGIN
PRINT N'Seeding table Genders...'
SET IDENT...
Hospitalet asked 22/3, 2012 at 9:27
2
Solved
I try to load a table, that have an identity column, with DB Unit. I want to be able to set the id value myself (I don't want the database generate it for me).
Here is a minimal definition of my ...
Leeds asked 17/11, 2010 at 14:57
2
Solved
For a sql script I'm working on, I need to programmatically remove the identity, identity seed, and identity increment for a column in an existing table, then add them back to the table at the end ...
Ob asked 1/10, 2010 at 17:30
2
Solved
What I need to do is have a SET IDENTITY_INSERT dbo.myTable ON statement, what's the syntax of using the above statement in a c# app?
Funches asked 30/7, 2010 at 15:36
1
Solved
I am trying to create a record in the db that has a predefined primary key value. I know how to do this with sql, but I was wondering if EF can do this for me? Otherwise, I will have to create a st...
Aeneus asked 26/7, 2010 at 3:7
3
Solved
I have to migrate this query (simplified here) from T-SQL to ORACLE
SET IDENTITY_INSERT table ON
INSERT INTO table (id, value) VALUES (1, 2)
SET IDENTITY_INSERT table OFF
id being an Identity ...
Benitobenjamen asked 3/5, 2010 at 15:4
2
got an issue with identity columns in Sql Server CE
when using Server explorer, in VS2008, executing the following script
SET IDENTITY_INSERT testTable ON;
Insert into testTable (id,name) values ...
Vituline asked 25/3, 2009 at 17:36
1
© 2022 - 2024 — McMap. All rights reserved.