如何使用SQL脚本查看数据库中表的扩展属性
SELECT
表名 = case when acolorder=1 then dname else '' end,
表说明 = case when acolorder=1 then isnull(fvalue,'') else '' end,
字段序号 = acolorder,
字段名 = aname,
标识 = case when COLUMNPROPERTY( aid,aname,'IsIdentity')=1 then '√'else '' end,
主键 = case when exists(SELECT 1 FROM sysobjects where xtype='PK' and parent_obj=aid and name in (
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = aid AND colid=acolid))) then '√' else '' end,
类型 = bname,
占用字节数 = alength,
长度 = COLUMNPROPERTY(aid,aname,'PRECISION'),
小数位数 = isnull(COLUMNPROPERTY(aid,aname,'Scale'),0),
允许空 = case when aisnullable=1 then '√'else '' end,
默认值 = isnull(etext,''),
字段说明 = isnull(g[value],'')
FROM
syscolumns a
left join
systypes b
on
axusertype=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 acolid=gsmallid
left join
sysproperties f
on
did=fid and fsmallid=0
where
dname='要查询的表' --如果只查询指定表,加上此条件
order by
aid,acolorder
以上就是关于数据库表的扩展属性主要包括哪些全部的内容,包括:数据库表的扩展属性主要包括哪些、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)