Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combining two dbf files with different fields 1

Status
Not open for further replies.

inteleserve

IS-IT--Management
Dec 13, 2002
75
US
I have file a containing:

fullname, address, city, state, zip, zip4, phone, ole, oma1e, score

I have file b containing:

fullname, address, city, state, zip, zip4, phone, ole, score, lender

I have file c containing:

fullname, address, city, state, zip, zip4, phone, fieldx, fieldz, ole, oma1e.


I want to combine all 3 of these files into a new file but I dont want anything to get cut off. I know I can go in and do a modi struc and make sure they all have the same structure, then append however if we have 50 fields this may take some time.

Any suggestions?

 
Hi,

I would create an empty structure containing all the fields from the 3 tables, and then append each one to it.

In your example it would be something like:

create dbf newfile (fullname, address, city, state, zip, zip4, phone, ole, oma1e, score, lender, fieldx, fieldz)
append from table_a
append from table_b
append from table_c

there is no need to modify structures.
 
Right, thats what I want to know. How do I create an empty structure containing all the fields from all 3 tables without doing the modi struc command.
(Lets say each table contained 50 fields)........................


Thanks,

Ross
 
Try this:

use table_a
copy structure extended to table1
use table_b
copy structure extended to table2
use table_c
copy structure extended to table3
select * from table1 union;
select * from table2 union;
select * from table3 into dbf newstruc
create newfile from newstruc
append from table_a
append from table_b
append from table_c

That should do it.
 
Yes, this works great. Thank you for your time...



Ross
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top