[dba-SQLServer]UNION Columns?

Arthur Fuller artful at rogers.com
Mon May 5 12:39:45 CDT 2003


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.



More information about the dba-SQLServer mailing list