Removing identity table column attribute

  • Is there anyway to remove the identity attribute for a table column permanently?

    I know that I could use the following statement to "temporarily" do inserts:

    set identity_insert ON;

    However, I was wondering if there was a cleaner way to accomplish this? Can I use some ALTER TABLE/COLUMN syntax?

  • As far as i know, this is the only way to set the identity_insert.

    Try to encapsulate the identity insert code into a TRIGGER..(personally never tried That).

    If you have multiple Tables, you have to SET the IDENTITY_INSERT to off before you work on the second table and turn the identity_insert to ON

  • You can't drop the identity property using ALTER TABLE. You'll either have to drop and recreate the table or use the "Design" option in SSMS to remove the identity property. SSMS does the drop and recreate behind the scenes.

    Greg

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply