Withdata Software

How to get column names from Sql Server table

SELECT [name] AS [Column Name] FROM syscolumns WHERE id = (SELECT id FROM sysobjects WHERE type = ‘U’ AND [Name] = ‘My_Table_Name’)

Type = ‘V’ for views Type = ‘U’ for tables

For SQL Server 2008, we can use information_schema.columns for getting column information:

SELECT * FROM information_schema.columns WHERE table_name = ‘My_Table_Name’ ORDER BY ordinal_position

See also:

How to get column names from DB2 table

How to get column names from Oracle table

How to get column names from Mysql table

How to get column names from PostgreSQL table

How to get column names from SQLite table

Some SQL Server tools you can try: https://www.withdata.com/sql-server/