I would like to query the name of all columns of a table. I found how to do this in:
But I need to know: how can this be done in Microsoft SQL Server (2008 in my case)?
I would like to query the name of all columns of a table. I found how to do this in:
But I need to know: how can this be done in Microsoft SQL Server (2008 in my case)?
This SO question is missing the following approach :
One other option which is arguably more intuitive is:
This gives you all your column names in a single column. If you care about other metadata, you can change edit the SELECT STATEMENT TO
SELECT *
.You can use
sp_help
in SQL Server 2008.Keyboard shortcut for the above command: select table name (i.e highlight it) and press ALT+F1.
By using this query you get the answer:
TABLE_NAME
is your table