Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Question Unanswered: How to add Identity property to existing table?

    Has anybody ever tried to do this. I can't figure it out. All I want to do is take an existing table that already has values in the column that I want to change and add the identity property to yes and set the identity seed and increment to a specific number. I know you can do it in the CREATE TABLE statement but is there a way to use the ALTER TABLE command?

  2. #2
    Join Date
    Sep 2003
    Location
    Dallas, Texas
    Posts
    311

    Re: How to add Identity property to existing table?

    Create a new table with same schema and the Identity column, then load the data into the new table, and then drop the old table.

  3. #3
    Join Date
    Jan 2004
    Posts
    8

    Re: How to add Identity property to existing table?

    i don't think so. even when you trying to remove the identity from a table, it will drop and recreate the table in the backgound. it can't just
    modify the table structure.


    Originally posted by randyfoy
    Has anybody ever tried to do this. I can't figure it out. All I want to do is take an existing table that already has values in the column that I want to change and add the identity property to yes and set the identity seed and increment to a specific number. I know you can do it in the CREATE TABLE statement but is there a way to use the ALTER TABLE command?

  4. #4
    Join Date
    Feb 2004
    Posts
    5
    even though I can just go to the design view of the table through the Enterprise Manager and change the property? It works fine if I do it manually.

  5. #5
    Join Date
    Sep 2003
    Posts
    522
    and try to run profiler while you're doing it, guess you'd answer your own question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •