Converting Primary Keys

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.
 
K

Klatuu

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top