Converting Primary Keys

  • Thread starter Thread starter meghanwh
  • Start date Start date
M

meghanwh

I have a database with many tables, all of which are joined by UID,
the primary key. Our main information system has gone through a change
and converted about 80% of the UIDs to a different number. Same
format, just new number. I have a list of the old IDs and the new IDs,
and I'm just wondering if there's a way to convert all of the old IDs
into the new IDs without simply doing a cut and paste in a query? I
need to make sure all the tables get converted. Thanks.
 
Create a table that has the ID conversions. One field for the old value and
one for the new value.

For each table you need to convert, create an update query that joins the
table with the conversion table on the old id. Construct the query so that
it will update the ID field in the table to the new value.
 
Back
Top