Thursday, March 8, 2012

Columns names

I need a querry to get all columns names.
thanksAll possible column names, or just the ones in your database?

Check out INFORMATION_SCHEMA.COLUMNS (http://msdn.microsoft.com/library/en-us/tsqlref/ts_ia-iz_87w3.asp) to see if that will help.

-PatP|||Select query against the Syscolumns table should work for you.|||Join Sysobjects to Syscolumns (ID) to get the table name corresponding each column.|||Just for what it is worth, the information_schema.columns view does exactly what the user wants, it is documented, works on many database engine platforms, and removes the need to reference system tables.

-PatP

No comments:

Post a Comment