19 September 2011

Get the list of columns in a table in sqlserver

select column_name from information_schema.columns where table_name='tblEmp'
or
sp_columns 'tblName'
or
select name from sys.columns where object_id=object_id('tblEmp')
or
select rows from sysindexes where id=object_id('tblEemp') and indid in (0,1)

No comments: