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
For getting only the column names you can use following one
SELECT Column_Name + ‘,’ FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = ‘TreeDataTable’
Leave a Reply