Query that will select all Tables in the database and create one table

TylerTand

Registered User.
Local time
Today, 13:40
Joined
Aug 31, 2007
Messages
95
I have a rotating number of tables that are created from excel spreadsheets that are imported. The Tables will change, but when they are there I need to be able to create a query that will merge them all together so I can run one query against all the tables. In SQL I know you can use a * to say Select *
From Table_1

Is there a syntax for the From portion so I can say:

Select *
From * (AKA all the tables in the Database)?

I have searched for a wildcard for the FROM statement that works like in the select statement but have been unsuccessful at finding an answer. Can anybody help? I'd list the Tables in the from Statement but there are 266 of them. Unless someone knows how to say:

Select *
From All tables in a folder with 266 excel spreadsheets

Thanks for your help
:)
 
You can create a query that unions tables but it won't support 255 tables and it will not "rotate".

Why not append each spreadsheet to a common table as you import it. You can add a column that you can use to identify the spreadsource if you need the data isolated for some purposes and merged for others.
 

Users who are viewing this thread

Back
Top Bottom