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

How to append four tables? 1

Status
Not open for further replies.

katrina11

Technical User
Apr 30, 2011
108
0
0
Hello Experts!

I have just faced problem of concantenating four tables with the same structure. Table1
Table2
Table3
Table4

I need the table named combined. How can I do it in SQL Server 2005?

Thank you!

Katrin
 
katrina11,
We're (go borg!) going to need more detail to help you with this one.

Do you need to have the table structures of all 4 tables be the same, or do you need to combine the information in all 4 tables into 1 new table?

Thanks,
Lodlaiden

You've got questions and source code. We want both!
 
Of course, if it's just a data-dump, one can use UNION ALL

Code:
SELECT * INTO Combined FROM
(SELECT * from Table1
UNION ALL
SELECT * from Table2
UNION ALL
SELECT * from Table3
UNION ALL
SELECT * from Table4)T1

soi là, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top