Home
How To ...
Trouble shooting
 

Cry How to...

List all columns in a table


To list all the columns in a table the simplest way is:

exec sp_help <table-name>

unfortunately this returns more than just the columns in the table. Alternately, to just list the columns use:

select name from syscolumns where id=object_id('<table_name>')

where <table_name> is the name of the table. For example:

select name from syscolumns where id=object_id('Employees')


These notes have been tested against SQL Server 7.