Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I remove a column's IDENTITY property in SQL script?

Status
Not open for further replies.

TheDrider

Programmer
Jun 27, 2001
110
US
I would like to be able to 'uncheck' the IDENTITY property of a column via SQL script. I can turn it *on* using ALTER TABLE-ALTER COLUMN, but the same ALTER TABLE statement without the IDENTITY keyword does not turn it *off*.

Can I turn off identity without going through the GUI?

Thanks
 
You would have to drop the column and then recreate it. Of course you loose what ever values were in the field before you dropped it.

Thanks

J. Kusch
 
Should you not want to lose the values, then copy them first to another column that is not an identity.

Of course then you have to go through a simliar process to copy the dat back to the recreated column and then drop the temporary holding column.

Usually people don't drop identity columns as they are used in relationships with other tables. You might have to drop and recreate those as well. ANd add a constratint to keep the vlaue unique if you are going to start hand netering them.

All in all a miserable unfun process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top