Turning On and Off Identity Column in SQL Server
General Form
SET IDENTITY_INSERT table name ON GO --Sql Insert Statement here
SET IDENTITY_INSERT table name OFF GO
When you transfer data from one table to another table using script then you should first on the identity field of the table by using the below query
SET IDENTITY_INSERT table name ON
Now you can write insert statement for inserting data into another table. After inserting the data into another table you should off the identity field of the table
SET IDENTITY_INSERT table name OFF
This is right solutions.Thanks a lot..
ReplyDelete