Update auto increment feild to replace nulls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimilives
    New Member
    • Aug 2008
    • 1

    #1

    Update auto increment feild to replace nulls

    I forgot to turn on auto increment when I reinstalled this database and now I have a bunch of NULL values in my ID field for last few hundred inserts, how can I update this table to replace the NULLS with a new ID value where the ID is an auto increment with out losing the ID values of old records, basically i want to do this:
    UPDATE ID SET id = 'NEW AUTO #' where ID = 'NULL'

    I hope this makes sense, I am not bound to having the numbers sequential to the old records so I was going to set the identity seed at 5000 (my old records stopped at id 4350 ) so if i start to seed from 5000 i know i wont use same ID
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    See if this thread helps.

    Comment

    Working...