• Register
0 votes
390 views

Problem :

I am facing following error while executing script
cannot insert explicit value for identity column in table when identity_insert is set to off.
6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I guess you are inserting values for an identity column.

You can easily turn on identity insert on the table like shown below to specify your own identity values.

e.g.
SET IDENTITY_INSERT Table1 ON

INSERT INTO Table1
/*Please note the column list is REQUIRED here not optional*/
            (OperationID,
             OpDescription,
             FilterID)
VALUES      (20,
             'Hierachy Update',
             1)

SET IDENTITY_INSERT Table1 OFF 
9 7 4
38,600 points

Related questions

0 votes
1 answer 8 views
8 views
Problem: cannot insert explicit value for identity column in table when identity_insert is set to off
asked Feb 23 Muneeb Saadii 130k points
0 votes
1 answer 2 views
2 views
Problem: Who is there to help me the following issue>cannot insert explicit value for identity column in table?
asked Apr 8 ashik 12.9k points
0 votes
1 answer 2 views
2 views
Problem: How to deal with the following issue:cannot insert explicit value for identity column?
asked Apr 8 ashik 12.9k points
0 votes
1 answer 1 view
1 view
Problem: I need someone to help me in solving this case:cannot insert when identity_insert is set to off.
asked Apr 8 ashik 12.9k points
0 votes
1 answer 3 views
3 views
Problem: Help me to know the way to insert values into table with identity column in sql server .
asked 5 days ago zayed1 35.6k points
0 votes
1 answer 48 views
48 views
Problem : I want to do below query INSERT INTO dbo.tbl_A_archive  SELECT * FROM SERVERxyz.DB.dbo.tbl_A However even after I ran below code set identity_insert dbo.tbl_A_archive on I am facing below error message “Can only be specified when a column list is used and IDENTITY_INSERT ... a huge number of columns. I can not type all of the columns out manually. How can I get this to be fixed?
asked Jan 29, 2020 jwilliam 3.9k points
0 votes
1 answer 49 views
49 views
Problem: I am able to create the table named employee which contains the column empid which is a computed column and empid column is the primary key also. It is the self referencing table and the column managerid references back to itself. But now if I try to save ... error my table is still working perfectly. I am trying to work in a table graphically not coding every time I make the change.
asked Jul 4, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 2 views
2 views
Problem: Do you have any suggestions about how I can solve this problem?
asked 4 days ago salim1 39k points
0 votes
1 answer 2 views
2 views
I wanted to know " sql server add identity column to existing table "
asked Apr 8 munim01 12.9k points