码迷,mamicode.com
首页 > 数据库 > 详细

统计数据库对象

时间:2016-01-22 18:21:33      阅读:233      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!