您的位置:首页 > 数据库

统计数据库对象

2016-01-22 16:00 363 查看
select case xtype
when 'C' then '约束'
when 'D' then '默认值约束'
when 'F' then '外键约束'
when 'FN' then '标量函数'
when 'IF' then '内嵌表函数'
when 'K' then '主键约束'
when 'L' then '日志'
when 'P' then '存储过程'
when 'R' then '规则'
when 'RF' then '复制筛选存储过程'
when 'S' then '系统表'
when 'TF' then '表函数'
when 'TR' then '触发器'
when 'U' then '用户表'
when 'V' then '视图'
when 'X' then '扩展存储过程'
when 'AF' then '聚合函数'
when 'FS' then '标量函数'
when 'FT' then '表值函数'
when 'IF' then '内联表函数'
when 'IT' then '内部表'
when 'PC' then '存储过程'
when 'FS' then '标量函数'
when 'PK' then '主键约束'
when 'SN' then '同义词'
when 'SQ' then '服务队列'
when 'TA' then '程序集 (CLR) DML 触发器'
when 'TT' then '表类型'
when 'UQ' then 'UNIQUE 约束(type 为 K)'
end as 类型,
count(1) as 数量
from dbo.sysobjects
group by
case xtype
when 'C' then '约束'
when 'D' then '默认值约束'
when 'F' then '外键约束'
when 'FN' then '标量函数'
when 'IF' then '内嵌表函数'
when 'K' then '主键约束'
when 'L' then '日志'
when 'P' then '存储过程'
when 'R' then '规则'
when 'RF' then '复制筛选存储过程'
when 'S' then '系统表'
when 'TF' then '表函数'
when 'TR' then '触发器'
when 'U' then '用户表'
when 'V' then '视图'
when 'X' then '扩展存储过程'
when 'AF' then '聚合函数'
when 'FS' then '标量函数'
when 'FT' then '表值函数'
when 'IF' then '内联表函数'
when 'IT' then '内部表'
when 'PC' then '存储过程'
when 'FS' then '标量函数'
when 'PK' then '主键约束'
when 'SN' then '同义词'
when 'SQ' then '服务队列'
when 'TA' then '程序集 (CLR) DML 触发器'
when 'TT' then '表类型'
when 'UQ' then 'UNIQUE 约束(type 为 K)'
end


本文出自 “sukun” 博客,请务必保留此出处http://sukunwu.blog.51cto.com/10453116/1737671
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: