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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Append Query 1

Status
Not open for further replies.

mssbass

IS-IT--Management
Aug 24, 2001
53
US
What code do I use if all the fields are the same type and just appending table(region0) to table (region1)?
 
SELECT region1
APPEND FROM DBF('region0') && if region0 is already open

SELECT region1
APPEND FROM C:\tables\region0 && region0 can be open or closed

or SQL:

SELECT * FROM region1 ;
UNION ;
SELECT * FROM region0 ;
INTO DBF c:\tables\region2
 
Is there a way to append several tables to the first table (1 at a time)? I'm using your code

select region1
append from c:\tables\region0

 
Well, that's the way. Append one by one just the same way. Or, if you wish, you can first union-select them all; or union-select all but one and then append to it.
 
I'm just saying can I set it up to run overnight to complete all tables?
 
Write a small program, and leave it running overnight. There is no difference what method you use in it (I am not sure what will be faster in your case), the program won't stop until it's done if it doesn't run into an error.

You can write a loop to do that. The names of the tables you can put in a cursor, table, or in array (using ADIR() or other means), or, if they all are so transparent as Region0, Region1, etc., you can just create them dinamically right in the loop.

If there are only a few of them, you can just list them all in a group of consecutive statements.

Another option would be to UNION-SELECT them all, including the one to which you append them. This way you can also sort the result and get rid of the duplicates if any.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top