How do I get table field properties and comments in Sql2008? Select B.[value] From Sys.columns a left join Sys.extended_properties B on a.object_id=b.major_id and A.column_id=b.minor _id INNER JOIN sysobjects C on a.column_id=c.id and a.[name]= ' column name ' and c.[name]= ' table name ' SELECT table name =case when a.colorder=1st En d.name Else ' end, table description =case when a.colorder=1 then IsNull (F.value, ') Else ' end, field ordinal =a.colorder, field name =a.name, identity =case when ColumnProperty (A.id,a.name, ' isidentity ') =1 then ' √ ' else ' end, primary key =case when exists (SELECT 1 from sysobjects where xtype= ' PK ' and name in (select name from sysindexes where Indid in (select Indid from sysindexkeys where id = a.i D and Colid=a.colid)) Then ' √ ' Else ' end, type =b.name, takes up bytes =a.length, length =columnproperty (a.id,a.name, ' PRECISION '), The number of decimal digits =isnull (columnproperty (a.id,a.name, ' scale '), 0), allows null =case when a.isnullable=1 then ' √ ' Else ' end, default value =isnull ( E.text, "), Field Description =isnull (G.[value], ') from syscolumns a LEFT join systypes B on a.xusertype=b.xusertype inner JOIN SYS Objects D on A.id=d.id and d.xtype= ' U ' and d.name<> ' dtproperties ' left joins syscomments E on a.cdefault=e.id left join SY S.extended_properties g on a.id=g.major_id and a.colid=g.minor_id left joins Sys.extended_properties F on d.id=f.major_id and f.minor_id=0--where d.name= ' orders '--if only the specified table is queried, plus this condition order by A.id,a.colorder
How do I get table field properties and comments in Sql2008?