Click here to Skip to main content
15,885,366 members
Articles / Database Development / SQL Server / SQL Server 2008
Tip/Trick

List SQL Server table column name as rows

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
2 May 2012CPOL 81.2K   2  
Simple query to get table column name as rows
This is an old version of the currently published tip/trick.

Introduction

Following script will give table column names as rows. Treat the table name as User

SQL
SELECT COLUMN_NAME 'All_Columns' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='User' 

 Following is the result. 

 

 History

  • May 03, 2012: Article created.  

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Sri Lanka Sri Lanka
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

Discussions on this specific version of this article. Add your comments on how to improve this article here. These comments will not be visible on the final published version of this article.