Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IDENTITY_INSERT 2

Status
Not open for further replies.

grnzbra

Programmer
Mar 12, 2002
1,273
US
I have the following code which results in an error message saying I can't insert a value in an identity column unless IDENTITY_INSERT is ON. It seems to match the example given for IDENTITY_INSERT. What might the problem be?
Code:
SET IDENTITY_INSERT CMMSSrc.dbo.rtblChecklistSeed ON					
INSERT INTO CMMSSrc.dbo.rtblChecklistSeed
SELECT * FROM GMMS_WorkOrders_Linds_Test.dbo.rtblChecklistSeed
WHERE fldPostKey = @OrgUnitKey
SET IDENTITY_INSERT CMMSSrc.dbo.rtblChecklistSeed OFF	
SELECT * FROM CMMSSrc.dbo.rtblChecklistSeed
 

You need to specify the particular columns for the insert:

Code:
INSERT INTO CMMSSrc.dbo.rtblChecklistSeed(columnName1, columnName2, etc...)


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top