Key code situation

Posted on 2006-03-30
Last Modified: 2010-04-23

   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 48

    Expert Comment

    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
    LVL 12

    Author Comment

    by:Alfredo Luis Torres Serrano
    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?
    LVL 12

    Author Comment

    by:Alfredo Luis Torres Serrano
    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
    LVL 48

    Expert Comment

    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)
    LVL 12

    Author Comment

    by:Alfredo Luis Torres Serrano
    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 :)

    Accepted Solution

    Closed, 250 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now