November 9, 2005 at 1:15 pm
Hello.
I have a old table of customers that I have to port over to a new DB. However, The new table it taking mostly new info, so I will only be moving 4 basic columns. The rest of the columns will remain blank.
My dilemma here is:
After a major overhaul of the records (taking out old/duplicate records), I have records with ID numbers that are all over the place. I want to redo these numbers to cleanly start from one on to whatever number of records we still have.
What would be the best method of achieving this?
November 9, 2005 at 11:48 pm
If the ids are plain numeric, define the id column on the new table as an identity and don't put any values into it. SQL will assign identity values automatically when you insert the records.
Bear in mind that you'll have to go through the db and update any foreign key refrences to the customerid, or they'll point to incorrect/non-existant customers.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply