Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to compare and update master table?
Message
De
04/05/2006 14:11:01
 
 
À
04/05/2006 13:49:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows Server 2003
Divers
Thread ID:
01119103
Message ID:
01119307
Vues:
19
This message has been marked as a message which has helped to the initial question of the thread.
>Oh No! It's dangerous. I prefer replace only the records modified.

Why dangerous? If you're worried, back up the original before you overwrite it. It seems to me that you want the "master" table to be exactly the same as the "temp" - if so, an overwrite is the surest way to achieve this.

If you really want to update manually you can use a general approach like this:
SELECT ;
  * ;
  FROM Master ;
  UNION ;
  SELECT ;
    * ;
    FROM Temp ;
  INTO CURSOR Changed

* The UNION clause by default removes duplicate rows. You will be left with a list of rows that are either:
* 1. Present in MASTER but not in TEMP
* 2. Present in TEMP but not in MASTER
* 3. Present in both tables, but different
Assuming you have a primary key on each table, you can scan the "Changed" cursor and update appropriately.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform