Click here to Skip to main content
15,888,610 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   4
Simple query to get table column name as rows

Introduction

The 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

 
QuestionNot an article Pin
Md. Marufuzzaman9-Feb-15 5:00
professionalMd. Marufuzzaman9-Feb-15 5:00 
Questionchange in to three tier Pin
padiharprem22-Oct-12 2:31
padiharprem22-Oct-12 2:31 
GeneralThoughts Pin
PIEBALDconsult3-May-12 11:41
mvePIEBALDconsult3-May-12 11:41 
GeneralRe: Thoughts Pin
Chamila Nishantha3-May-12 17:48
Chamila Nishantha3-May-12 17:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.