Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Merging Primary Keys
Message
De
13/07/1998 15:49:48
 
 
À
13/07/1998 14:16:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00116862
Message ID:
00116921
Vues:
17
Bill,

What Mark & Don suggested would be the appropriate approach. What do you mean
when you state 'I don't know all the Child Tables'? How are you going to determine
when you have duplicate primary accts?

Once you identify the primary accts duplicates
and which account you need to merge in the other then you update your child tables
foreign key to the primary table. Then you can remove the primary account which
you merged from.

Are you saying that you don't know which tables are
linked/related or have a foreigh key to the primary account table? Disabling RI for
the primary table does not gain you anything but headaches.

-myron kirby-
====================================================
>>>Does any one know how to merge 2 primary keys into 1 (including all the child tables)?
>>>The thing I'm looking for is like Quicken's ability to merge 2 accounts into 1 when they have the same name.
>>>
>>>Obviously when I try to change the primary key field in a table, VFP won't allow it. If there were some way to build into the RI to change the child tables, then I could just delete the extra parent record, but I can't figure out how to do that either (and have it automatically updated as new child tables are created).
>>>
>>>TIA
>>
>>
>>Bill,
>>
>>If you know the key to merge all the "other" categories into the "original primary", you can just use an update...
>>
>>
>>update (child table);
>>   set primaryID = (original primary);
>>   where primaryID = (other primary key)
>>
>
>That's the issue, I don't know all the Child Tables. I want something like the RI to update all the keys in the child tables, but I can't set the parent table to the new value (to trigger the RI into updating all the Child Tables), because the new value already exists in the Parent Table.
>
>I think what I'm looking for is something like this:
>(1) turn off any deleting restrictions in the parent table ('ignore' instead of 'cascading' or 'restricting').
>(2) delete one of the parent records (leaving all the child records orphaned for a second).
>(3) change the key in the other parent record to the deleted value (cascading the change through all the child tables), thereby picking up all those orphaned child records.
>(4) turn the deleting restrictions back on in the parent table.
>
>Unfortunately I can't figure out how to turn off the deleting restrictions.
----------------------------------
-myron kirby (mkirby2000@gmail.com)-
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform