Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending Tables
Message
From
03/05/1999 16:11:19
 
 
To
03/05/1999 15:19:31
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00214690
Message ID:
00214725
Views:
24
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform