当前位置: 代码迷 >> Sql Server >> 用户建立的储存过程个数如何统计
  详细解决方案

用户建立的储存过程个数如何统计

热度:82   发布时间:2016-04-27 16:34:10.0
用户建立的储存过程个数怎么统计?
我要统计所有用户建立的,系统的储存过程,还有删除用户建立的,有没有sql语句可以实现

------解决方案--------------------
--系统存储过程
select name from sysobjects where xtype= 'P ' and category=2

--用户自定义存储过程
select name from sysobjects where xtype= 'P ' and category=0

--删除所有用户自定义存储过程
declare @sql varchar(8000)
set @sql= ' '
SELECT @[email protected]+ 'drop proc '+NAME+char(13) FROM SYSOBJECTS
WHERE xtype= 'P ' and category=0
exec(@sql)
  相关解决方案