set identity_insert table_name on
insert......
set identity_insert table_name off
How to alter a normal column into Identity column?insert......
set identity_insert table_name off
This really created a problem and I solved in the following fashion.
Just change the previous table as a different name and then create a new table with the name of the former table. But be careful that if the previous table has some PK-FK relationship , you have to use the Alter Table query to change the relationship
ALTER TABLE [dbo].[ITradeOrderItems] DROP CONSTRAINT
[FK__NAME]
[FK__NAME]