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

Return Column Names from a Table 1

Status
Not open for further replies.

codeWarrior456

Technical User
Oct 27, 2002
27
US
Is there a way to write a query that just returns the names of all the columns in a given table? If so, how can this be done?

Thanks for your help in advance.
 
Code:
select column_name 
  from information_schema.columns
 where table_name = 'GIVEN'
 
have a look at the built in stored procedures sp_help and sp_columns too:
Code:
sp_help GivenTable
sp_columns GivenTable

Try them out in QA - sp_help gives you lots of useful info.


Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top