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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only selected columns from sp_columns

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
0
0
GB
I can achieve a list of field information (following a recent post and helpful replies) using the SQL syntax
EXEC sp_columns @table_name = 'Table1'
Suppose I only want a subset of this return data set ?
Suppose I only want a list of the 'COLUMN_NAME' entries - how can I do this through the means of a single SQL statement ? I want to try to avoid using temporary tables if I can (as I'm none too familiar with them and want to avoid learning curves).

Any help would be appreciated.
Thanks in advance
Steve
 
Hello Steve!

You can use INFORMATION_SCHEMA :

SELECT Column_name FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME = 'table1'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top