Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
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 1Cannot 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?
itsonlyme4
Posting Yak Master
109 Posts
Posted - 2008-01-15 : 14:49:11
is it safe to temporarily set SET IDENTITY_INSERT mytable ON
itsonlyme4
Posting Yak Master
109 Posts
Posted - 2008-01-15 : 15:42:47
I referred to BOL "SET IDENTITY_INSERT my table ON"
rmiao
Master Smack Fu Yak Hacker
7266 Posts
Posted - 2008-01-15 : 23:39:21
You have to unless take out identity from target table or don't copy values of that column.