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

use a select to do an insert?

Status
Not open for further replies.

noober

IS-IT--Management
Oct 10, 2003
112
US
Is it possible to insert all of the data from one table into another table with the exact same table structure?
 
Hi:

Yes, if table1 and table2 have the same structure you can do something like this:

insert into table1 select * from table2

Of course, you can use a where clause on the select or even use a subset of the table structure:

insert into table1(col1, col2, col3) select col1, col2, col3 from table2 where col1 = "something"

Regards,

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top