菜鳥學(xué)堂: 
select 
       (case when a.colorder=1 then d.name else '' end)表名,
       a.colorder 字段序號(hào),
       a.name 字段名,
       (case when columnproperty( a.id,a.name,'isidentity')=1 then '√'else '' end) 標(biāo)識(shí),
       (case when (select count(*)
       from sysobjects
       where (name in
                 (select name
                from sysindexes
                where (id = a.id) and (indid in
                          (select indid
                         from sysindexkeys
                         where (id = a.id) and (colid in
                                   (select colid
                                  from syscolumns
                                  where (id = a.id) and (name = a.name))))))) and
              (xtype = 'pk'))>0 then '√' else '' end) 主鍵,
       b.name 類型,
       a.length 占用字節(jié)數(shù),
       columnproperty(a.id,a.name,'precision') as 長(zhǎng)度,
       isnull(columnproperty(a.id,a.name,'scale'),0) as 小數(shù)位數(shù),
       (case when a.isnullable=1 then '√'else '' end) 允許空,
       isnull(e.text,'') 默認(rèn)值,
       isnull(g.[value],'') as 字段說(shuō)明    
 
from  syscolumns  a left join systypes b 
on  a.xtype=b.xusertype
inner join sysobjects d 
on a.id=d.id  and  d.xtype='u' and  d.name<>'dtproperties'
left join syscomments e
on a.cdefault=e.id
left join sysproperties g
on a.id=g.id and a.colid = g.smallid  
order by a.id,a.colorder