Belliez Belliez - 4 years ago 110
SQL Question

SQL Server: How do you return the column names from a table?

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

Answer Source

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

USE [Database Name]
WHERE TABLE_NAME = 'YourTableName' AND TABLE_SCHEMA='YourSchemaName'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download