SELECT
表名=case when lorder= then dname else end
表说明=case when lorder= then isnull(fvalue) else end
字段序号=lorder
字段名=aname
标识=case when COLUMNPROPERTY( aidanameIsIdentity)= then √else end
主键=case when exists(SELECT FROM sysobjects where xtype=PK and name in (
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = aid AND colid=lid
))) then √ else end
类型=bname
占用字节数=alength
长度=COLUMNPROPERTY(aidanamePRECISION)
小数位数=isnull(COLUMNPROPERTY(aidanameScale))
允许空=case when aisnullable= then √else end
默认值=isnull(etext)
字段说明=isnull(g[value])
FROM syscolumns a
left join systypes b on axtype=bxusertype
inner join sysobjects d on aid=did and dxtype=U and dname<>dtproperties
left join syscomments e on acdefault=eid
left join sysproperties g on aid=gid and lid=gsmallid
left join sysproperties f on did=fid and fsmallid=
where dname=要查询的表 如果只查询指定表加上此条件
order by aidlorder