SQL script to remove identity property

  • Hi,

    Please let me know if any one r aware of removing the identity property through sql script for a column?

    thanks,

    Indu

  • ALTER table tablename

    ALTER column columnname datatype

    through wizard its more easy...

  • oh sorry iam wrong...

    if you want to disable the identity for a while

    use SET IDENTITY_INSERT ON/OFF

    to remove identity property then i suggest wizard.rick click on the table-->modify table

    any other ideas how to remove identity property through T-SQL???

  • Through T-SQL its quite complex...

    Create another table say table_test with same structure as your table except the identity property.

    Move the data into the table_test using insert into...

    Rename the original table to table_old

    Rename the table_test to original table name...

  • Hi Reddy

    Will this work on 2008, since i tried the same on 2008 management studio, it gave me an error stats that the table has to be dropped, 🙂

  • where exactly you got the error??Paste the error...

  • Thanks mate, just to mention i used SQL Management and then opened the design of table from menu, then changed the Idnetity spec option to No and tried to save this , i got the following error( attached as a bmp file), but i can do this on 2005.

    How do i upload a image file with this post 🙁

Viewing 7 posts - 1 through 6 (of 6 total)

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