Msg 8101, Level 16, State 1, Line 4 An explicit value for the identity column in table 'Credit_Office_CONSOL.dbo.AgriculturalHoldings' can only be specified when a column list is used and IDENTITY_INSERT is ON. code example

Example: Msg 8101, Level 16, State 1, Line 7 An explicit value for the identity column in table 'department' can only be specified when a column list is used and IDENTITY_INSERT is ON.

SET IDENTITY_INSERT [MyDB].[dbo].[Equipment] ON

INSERT INTO [MyDB].[dbo].[Equipment]
            (COL1,
             COL2)
SELECT COL1,
       COL2
FROM   [MyDBQA].[dbo].[Equipment]

SET IDENTITY_INSERT [MyDB].[dbo].[Equipment] OFF

Tags:

Misc Example