Categories

Rabu, 2008 Agustus 13

List all columns in a table

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

exec sp_help

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('')

where is the name of the table. For example:

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