首页 > 数据库技术 > 详细

统计数据库对象

时间:2016-01-22 18:21:07      阅读:209      评论:0      收藏:0      [点我收藏+]
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

统计数据库对象

原文:http://sukunwu.blog.51cto.com/10453116/1737671

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!