Quantcast
Channel: Solved » sql-server
Viewing all articles
Browse latest Browse all 48

How Can I Get Column Names from a Table in SQL Server

$
0
0

Please can someone show me how I would return the column names of a table using SQL server 2008?

i.e. a table contains the columns id, name, address, country and I want to return these as data?

Thank you

Solution

Not sure if there is an easier way in 2008 version.

SELECT COLUMN_NAME,* 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'YourTableName' AND TABLE_SCHEMA='YourSchemaName'

The post How Can I Get Column Names from a Table in SQL Server appeared first on Solved.


Viewing all articles
Browse latest Browse all 48

Trending Articles