by Nathan
3. February 2009 17:26
To get the column names of a table in MSSQL
SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = 'TableName'
This is basically the MSSQL equivalent
for The MySQL Command DESCRIBE TableName which displays the table details
I often use this so i can copy and paste into another query etc.
SELECT Column_Name + ',' FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = 'TableName'
then i have the commas for use in any INSERT or SELECT etc
1da5125e-9d13-4f5f-91f0-8dfe99c0231f|1|5.0
Tags: sql
SQL