Key code situation


   I have an application that have many many tables with data all references by a code key for example the passport number, What i need from you is some idea to confront with the next situation.

   If a person comes tomorrow and tell me that that passport number is incorrect how can i do to chane the reference to that person with the less work popssible.

  For example creating a duplicate record in the main table refering the old pasport numberand the new one.

The best idea get the reward :)
LVL 12
Alfredo Luis Torres SerranoDevelopment Director / DBAAsked:
Who is Participating?
Closed, 250 points refunded.
The Experts Exchange
Community Support Moderator of all Ages
I would have 2 Columns holding the info

UniqueID - Which holds the Identity (increments with each number)
PAssportID - An ID thats changeable

OF course through your whole program you will use the UniqueID but for the Interface you will show the PassportID
Alfredo Luis Torres SerranoDevelopment Director / DBAAuthor Commented:
Yes bu the problem here is that i have data that i need to be refereced to the new passprt id, that is i have a lot of documents with the old ID. How do my interface will now that the old documents belong to the same person?
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Alfredo Luis Torres SerranoDevelopment Director / DBAAuthor Commented:
Never mind forgot that, The problem is that i have a lot of tables referenced with the document number´'Passport id' and a table with the unique id and the passport and other tables that mae reference to the id.

How can i change the passport without having to change all the tables
you would have to create a Batch Utility where you would go through all the tables and change the id

Update Tablename set PassportID = (Select UniqueID FROM MasterIds WHERE PID = PassportID)
Alfredo Luis Torres SerranoDevelopment Director / DBAAuthor Commented:
Thanks mike but i found the correct solution that was.

     Duplicate the master record with the new passportid hold in a var the old passportid, the new one and the id assigned to it, later i will replace in the conextion table the id with the new passportid.

Godd Hunt :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.