Add identity to existing column

  • Hi,

    RDBMS sql server 2005

    I have a table with int column.

    Now when I add identity with SSMS , it say you have to drop and recreate table.

    can you please tell me how can I add identity to existing column?

  • You gave the answer yourself. Drop the column and add it again with the identity property.

    John

  • no other way?

    as this column can be primary and reference exist on many places, so drop and recreate can create some problems.. 🙁

  • If you do it in the table design mode of SSMS, all of that will be taken care of automatically and safely.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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