MSG 8101 copy error Identity_insert

I have two table exactly same.But when I try to copy one to another (empty), I get an error message.

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

Because I have a primary key in the table.If wediscard the id,copy issue is succesfuly done.But,I need to copy them.

After that,I tried this codes.

SET IDENTITY_INSERT [X].[Transactions] ON
GO

INSERT INTO [X].[Transactions] select * from [x].[TransactionLine]
GO

SET IDENTITY_INSERT [X].[Transactions] OFF
GO

September 1st, 2015 2:58am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics