How to get all the column names of a table in SQL Server ?

If you have a scenario where you need to get all the column names of a table in SQL Server , you can query the database’s INFORMATION_SCHEMA.Columns table by specifying the table name.

How to get all the column names of a table in SQL Server ?

Here’s a query to demonstrate how to achieve this.

Use AdventureWorks2014
GO

SELECT * From INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME = N'Employee'

This would display all the columns of the table “Employee” and its information from the AdventureWorks2014 table.

image