表名       = Case When A.colorder=1 Then Else '' End,

     表说明     = Case When A.colorder=1 Then isnull(F.value,'') Else '' End,

     字段序号   = A.colorder,

     字段名     =,

     字段说明   = isnull(G.[value],''),

     标识       = Case When COLUMNPROPERTY(,,'IsIdentity')=1 Then '√'Else '' End,

     主键       = Case When exists(SELECT 1 FROM sysobjects Where xtype='PK' and and name in (

                      SELECT name FROM sysindexes WHERE indid in( SELECT indid FROM sysindexkeys WHERE id = AND colid=A.colid))) then '√' else '' end,

     类型       =,

     占用字节数 = A.Length,

     长度       = COLUMNPROPERTY(,,'PRECISION'),

     小数位数   = isnull(COLUMNPROPERTY(,,'Scale'),0),

     允许空     = Case When A.isnullable=1 Then '√'Else '' End,

     默认值     = isnull(E.Text,'')


     syscolumns A

 Left Join

     systypes B



 Inner Join

     sysobjects D

 On  and D.xtype='U' and<>'dtproperties'

 Left Join

     syscomments E


 Left Join

 sys.extended_properties  G

 on and A.colid=G.minor_id

 Left Join

 sys.extended_properties F

 On and F.minor_id=0

     --where'OrderInfo'    --如果只查询指定表,加上此条件

 Order By,A.colorder