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