Tuesday, July 13, 2010

Insert Data with Identity Column

To Insert data in identity column
set identity_insert table_name on
insert......
set identity_insert table_name off
How to alter a normal column into Identity column?
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]

No comments:

FEEDJIT Live Traffic Feed