Linked Questions
39 questions linked to/from Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF
12
votes
3
answers
111k
views
An explicit value for the identity column in table 'customers' can only be specified when a column list is used and IDENTITY_INSERT is ON [duplicate]
Possible Duplicate:
Cannot insert explicit value for identity column in table ‘table’ when IDENTITY_INSERT is set to OFF
I am new to SQL. I am trying to write a INSERT query in SQL server 2008 ...
7
votes
2
answers
98k
views
SQL Cannot insert explicit value for identity column in table 'Table' when IDENTITY_INSERT is set to OFF [duplicate]
Structure tables and result query on sqlfiddle
I want use query:
INSERT INTO Price (id_price, id_firm, id_city, name)
VALUES
('12002', '1429', '73041', 'АРЕНДА (ПРОКАТ) АВТОКРАНА Г/...
-1
votes
1
answer
3k
views
Cannot insert explicit value for identity column in table 'tbl Fingerprint' when IDENTITY_INSERT is set to OFF [duplicate]
I'm trying to insert data into fingerprint table which has four columns
- ID (primary key)
- StudentID (foreign key) linked to student table
- description
- Template
But the following ...
-2
votes
2
answers
2k
views
MS IDENTITY_INSERT is set to OFF [duplicate]
I am currently working on my SQL Server project. I came across this error, and don't know how to fix it. I checked other stack posts, and it didn't work for me. I also tried YouTube. I saw a video and ...
-1
votes
2
answers
64
views
i have values i want to execute it in table in SqlDatabase and i use stored procedures , parameters [duplicate]
when i try this code
public void ExcuteCommand(string stored_procedure, SqlParameter[] param)
{
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.CommandType = CommandType....
0
votes
0
answers
54
views
Cannot insert data into a table which has an identity constraint [duplicate]
CREATE TABLE Customer
(
CustomerID int identity(100,1) PRIMARY KEY,
CustomerName varchar(55) not null,
contact int not null,
[Address] text
)
INSERT INTO Customer (CustomerID, ...
12
votes
4
answers
15k
views
EntityFramework Core - Copying an entity and placing it back into the database
Is there a best practice for doing a copy of an entity, making some changes to it based on user input, and then re-inserting it into the database?
Some other Stackoverflow threads have mentioned ...
3
votes
2
answers
30k
views
IDENTITY_INSERT is set to OFF?
Here is my script of my db ,
CREATE TABLE [dbo].[MyTable](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Code] [nvarchar](25) NULL,
[Name] [nvarchar](25) NULL,
[dob] [date] NULL ,
CONSTRAINT [PK_MyTable] ...
5
votes
3
answers
5k
views
Hibernate insert failing when embedded key contains identity column on SQL Server
I'm trying to map an entity with hibernate, but with SQL Server, I am not able to proceed.
Following are the details.
SQL Server Entity
CREATE TABLE [dbo].[BOOK_EMBEDDED](
[row_id] [bigint] IDENTITY(...
1
vote
2
answers
21k
views
SqlException: Cannot insert explicit value for identity column in table [Table name] when IDENTITY_INSERT is set to OFF
I am creating a website for expense tracking and when I send a new POST request calling AddNew method to add a new Entry I get this error:
SqlException: Cannot insert explicit value for identity ...
1
vote
2
answers
7k
views
Entity Framework Throwing Cannot Insert Explicit Value for Identity Column In Table ... When IDENTITY_INSERT is set to OFF Error
I am using Microsoft SQL Server 2008 R2 and have three relevant tables:
ConvertCarbs, Countries and StateProvinces
Using the EF Power Tools I have Reverse Engineered the Database (http://msdn....
0
votes
1
answer
4k
views
IDENTITY_INSERT is set to OFF in MVC application
I am trying to create a new employee in MVC 5. I used CRUD to generate views and models. I edited a few lines of code and I get this error:
Cannot insert explicit value for identity column in table '...
4
votes
1
answer
4k
views
Spark write Dataframe to SQL Server Table with Insert Identity On
I have a Spark Dataframe that I want to push to an SQL table on a remote server. The table has an Id column that is set as an identity column. The Dataframe I want to push also has as Id column, and I ...
0
votes
1
answer
4k
views
Cannot insert explicit value for identity column in table when identity insert is set to off
I tried filling in a table I generated using EF Core with values through Microsoft SQL Management Studio, since the list was predefined and wouldn't require editing in the future. I got the error I ...
0
votes
2
answers
3k
views
System.Data.Entity.Infrastructure.DbUpdateException error even when i am not updating the id column
I am working on a project where I am using Entity framework to manipulate a DB on sql server 2014.
My code is the following:
private void BtnAddUser(object sender, EventArgs e)
{
var u = ...