January 15, 2008 at 12:40 pm
INSERT INTO Db.mytable (column1, column2, column3, id)
SELECT column1, column2, column3, id
FROM db.mytableNBdoc WITH (NOLOCK)
WHERE id = 9795008
Server: Msg 544, Level 16, State 1, Line 1
Cannot insert explicit value for identity column in table 'nbdoc' when IDENTITY_INSERT is set to OFF.
I don't really understand the error. can someon help?
January 15, 2008 at 12:44 pm
You should read the "SET IDENTITY_INSERT" topic in SQL Server Books Online.
January 15, 2008 at 12:47 pm
am I going to mess anything up in my table temporarily setting it to
SET IDENTITY_INSERT mytable ON
January 15, 2008 at 1:00 pm
Hello,
Before going ahead with setting the identity insert to on and then inserting the record, make sure that there is no record available for the specific id. Based on your database design if the table has a primary key on the "id" column then it won't allow you to insert a duplicate record with the same "id" value even though you set the identity insert to on.
Hope this helps you.
Thanks
Lucky
January 15, 2008 at 1:41 pm
Yes, it helps!!!! THANK YOU!!!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply