Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending Tables
Message
De
03/05/1999 16:11:19
 
 
À
03/05/1999 15:19:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00214690
Message ID:
00214725
Vues:
23
>Im a newbie to this. I want to append two tables. Both are similar in structure. Tabel A and Table B. I willbe appending A into B. Some of the records in Table A, in the first field "Invno" are also in TAble B. How do I do it so that it will only append with "invno" records that are not in B?

If the two tables have identical invno fields:

SELECT * from table B ;
WHERE invno NOT IN (SELECT invno FROM table A) ;
INTO CURSOR Temp
SELECT table A && it's been opened above
APPEND FROM (DBF('Temp'))
USE IN Temp
USE IN table B

Note that this won't handle any structural differences for you; the cursor from the first SELECT will give the records from table B whose invno doesn't already exist in table A, so you could spin through it and do inserts into A.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform