Thursday 24 January 2019

How can I get column names from a table in SQL Server?

You can obtain this information and much, much more by querying the Information Schema views.


SELECT *
FROM YOURDBNAME.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'CUSTOMERS'