Reputation: 65
sp_help lists the table columns but they are not sorted as per their names (perhaps as per the actual order in which they are present in table i guess). For many columns in a table it gets difficult to find a column name , so is there any way i can see column names sorted by their names.
Upvotes: 0
Views: 2172
Reputation: 7766
select col.name from
sysobjects tab
inner join
syscolumns col
on tab.id = col.id
where tab.type = 'U'
and tab.name = 'TABLE_NAME'
order by col.name
Upvotes: 1