I get an error
Cannot insert explicit value for identity column in table 'Table1' when IDENTITY_INSERT is set to OFF
I have set the IDENTITY_INSERT
to ON
by using the query SET IDENTITY_INSERT [Database1].[dbo].[Table1] ON
, but still i get this error. In my case I am trying to copy the data of one table to an another so copying the ID
. I have set the identity_insert
to ON
. I do not know why i get this error.
CREATE TABLE [Database1].[dbo].[Table1]
(ID int IDENTITY,
Machinetyp nvarchar(255),
Flaeche float not null,
Losnumberr nvarchar(255),
Current float not null,
RK float not null,
);
GO
SET IDENTITY_INSERT [Database1].[dbo].[Table1] ON