SQL to append all data in one table to another

G

Guest

T1 (table1) contains today's data. Each night a program will be run to sweep
all the data in T1 into T2. Then T1 is refreshed with current data again.

T1 and T2 are structurally identical. The only difference is that T2
contains history and T1 only contains today's data.

For purposes of this example suppose both tables have fields: F1, F2, F3,
and F4 (actually there are 35 fields).

For reasons I can't describe briefly both tables are needed.

Can someone please post the SQL string necessary to perform the nightly
sweep? Is there a way to append the data to T2 with SQL without having to
loop thru all the fields? Thanks much in advance.
 
G

Guest

Because both tables have the same structure, you don't have to specify which
field to append to which field, just use the TableName.*

INSERT INTO T2
SELECT T1.*
FROM T1
=====================
 
G

Guest

Thanks! - Works perfectly!

Ofer said:
Because both tables have the same structure, you don't have to specify which
field to append to which field, just use the TableName.*

INSERT INTO T2
SELECT T1.*
FROM T1
=====================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top