create table with fields from join

msmeth
10-26-2004, 06:30 AM
How can I create a table using the fields from a large join as the fields in one large master table? I don't want the data in the new table; just a new blank table with the fields the same....I want it to be as generic as possible so that if any of the souce tables are changed (a new column added), the query will add this column to the master table too. I could create a view (this is SQL Server 2000) into a new table and delete the contents I suppose.....is there another way?

MKoslof
10-29-2004, 01:12 PM
Why does this have to come from a JOINED result set? Obviously, a table need a static string declaration for its column names, such as "field1". Can't you create the table via a standard CREATE TABLE script passing in the names from the original table? You can use the DMO library to get all field names in the current table and send these values as string parameters to your create table script.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum