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!

Create new table from columns in multiple tables? 1

Status
Not open for further replies.

Turb

Technical User
Feb 11, 2003
154
US
Hi All!

I would like to create a new, empty table (structure only, no data) from three other existing tables.

For example:
I have table A which has 25 fields and table B which has 35 fields and table C which has 20 fields.
I want to create a new table of 80 fields all of which are named and formatted as are those in tables A, B & C.

Is there any way to do this using a query or something?

Thanks in advance!


- Turb
 
Perhaps this (SQL code) ?
SELECT * INTO newTable FROM A, B, C WHERE 1=2

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,
Thank you for responding.

I'm getting a 'Too many fields defined' error.
I guess my tables are too big. Rats! Oh well...

I'm curious, what does the 1=2 do in this SQL statement?


- Turb
 
It always return a false value and thus your new table will not receive any data.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

Nice trick! :)

BTW, once I remove one of the tables, this code worked nicely.

You get a star my friend!

My tables are just too big to allow me to do what I wanted. :(


- Turb
 
From your first post, you stated you'd only have 80 fields. Tables can have 256. So how are your tables too big?
More basic question, are they normalized? If they are, then you're un-normalizing them. Not the way Access should be used.
 
Hi fneily!
The field quantities I stated above where just examples.
In reality, Table A has 68 , table B has 112 and table C has 123.
I didn't think to count them before trying this.


- Turb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top