Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compare Tables
Message
De
22/08/2002 07:12:21
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
21/08/2002 19:51:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00692106
Message ID:
00692364
Vues:
29
>Oops, I left out an important element in the question. I want to compare the DATA to see if the file are identical.
>
>Bill

Now that is a major challenge. You could do a byte-by-byte comparison. Or, especially if your table has a PK, you could run a SELECT statement to see, for instance, what records are in one table but not in the other, or what records have different values in certain fields.

A byte-by-byte comparison is actually quite easy:
? FileToStr("Table1.dbf") = FileToStr("Table2.dbf")
* .T. if identical
Since the tables might have the same data in a different order (especially in the memos!), I would first copy them to temp tables:
use Table1 order "MyPK"
copy to Temp1
use Table2 order "MyPK"
copy to Temp2
use
? "Table1 and Table2 are " + iif(FileToStr("Temp1.dbf") = FileToStr("Temp2.dbf"), "identical", "different")
? "The corresponding memo files are " + iif(FileToStr("Temp1.fpt") = FileToStr("Temp2.fpt"), "identical", "different")
HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform