Q
Problem solve Get help with specific problems with your technologies, process and projects.

Updating existing records with new primary key

I have a SQL Server 2000 database with several tables that use a social security number as a primary key. I am working to update this system to no longer use social security numbers as a key, but to instead use another assigned number. What would be the best way to update the existing records in the database with the new key?

Create a mapping table that maps the old ID to the new ID, generate a new ID for each one, and then use that to populate your new column to ensure all of the relationships come across intact.

 

For More Information

This was last published in April 2003

Dig Deeper on Microsoft SQL Server Installation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close