[dba-SQLServer]UNION Columns?

Billy Pang tuxedo_man at hotmail.com
Mon May 5 13:11:11 CDT 2003


select table_name, column_name, data_type from information_schema.columns;

HTH
Billy






>From: "Arthur Fuller" <artful at rogers.com>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: <dba-sqlserver at databaseadvisors.com>
>Subject: [dba-SQLServer]UNION Columns?
>Date: Mon, 5 May 2003 13:39:45 -0400
>
>I'm working on an app that could have used some normalization smarts in its
>gestation, to be gentle. There are no less than 6 nearly identical tables,
>with dozens of columns. I want to resolve them all into a single table
>called Persons, and then from there break out their addresses (gak! There
>are multiple embedded addresses in each of the six tables; I'm gonna blow
>chunks in a minute :-) etc.
>
>What I want right now is a SELECT statement that will give me the column
>names and types etc. as rows from each table. Then I can UNION them and 
>lose
>all the duplicates and then create my Persons table and append all the rows
>from the 6 tables. I took a look at syscolumns but I don't really 
>understand
>it.
>
>Can anyone offer a sample query that lists the columns for a specified
>table?
>
>A.
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail



More information about the dba-SQLServer mailing list