Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server / SQL-Server-2008

List SQL Server table column name as rows

5.00/5 (2 votes)
2 May 2012CPOL 81.7K  
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)