tags:

views:

20

answers:

1

I need to insert data from several tables with all the same field names into one temp table, i know i can use cursor/loop to do this, i wanted to know is there a quicker way of doing this.

select from table 1, table 2, table 3, into #temptable.

+3  A: 
select * into #temptable from table1

insert into #temptable select * from table2
insert into #temptable select * from table3

The first query creates the temp table on insert, the rest just keep adding data.

Fosco