View Single Post
Old 12-21-2005, 06:51 PM   #2 (permalink)
sandman
Junior Member
 
Join Date: Jul 2005
Posts: 36
Default

If the tables share the same structure (same number of columns, each matching pair of columns with the same datatype), then the syntax is really simple --

insert
into table2
select *
from table1
If the tables do not share the same structure, then you must name the columns of the table you are inserting into, and provide an expression for each of them in the subselect --

insert
into table2
( col1
, col2
, col3 )
select field3
, ( field7 + field8 ) * 9.37
, 0
from table1

INSERT INTO is great because of this ability to reformat data as part of the insertion process.
sandman is offline   Reply With Quote
Sponsored Links