--20081008 技术不高,但想出名 NAME:KYE
DECLARE @Sp_Name varchar(30) --定义游标操作
DECLARE @Tb_Count int
SET @Tb_Count = 0
DECLARE staff_cursor CURSOR FOR
SELECT [name] FROM sys.sysobjects
WHERE type='p' AND Category =0 --Category =0 表示
-- 打开游标
OPEN staff_cursor
-- 提取记录数据
FETCH Next FROM staff_cursor Into @Sp_Name
PRINT '开始删除存储过程'
WHILE @@fetch_status = 0
BEGIN
SET @Tb_Count = @Tb_Count + 1
EXEC('DROP PROCEDURE ' + @Sp_Name )
PRINT CONVERT(varchar(20),@Tb_Count) + ': ' + @Sp_Name
FETCH Next FROM staff_cursor Into @Sp_Name
END
print '总共删除' + CONVERT(varchar(20),@Tb_Count) + '个存储过程'
CLOSE staff_cursor -- 关闭游标
DEALLOCATE staff_cursor -- 释放游标资源
DECLARE @Sp_Name varchar(30) --定义游标操作
DECLARE @Tb_Count int
SET @Tb_Count = 0
DECLARE staff_cursor CURSOR FOR
SELECT [name] FROM sys.sysobjects
WHERE type='p' AND Category =0 --Category =0 表示
-- 打开游标
OPEN staff_cursor
-- 提取记录数据
FETCH Next FROM staff_cursor Into @Sp_Name
PRINT '开始删除存储过程'
WHILE @@fetch_status = 0
BEGIN
SET @Tb_Count = @Tb_Count + 1
EXEC('DROP PROCEDURE ' + @Sp_Name )
PRINT CONVERT(varchar(20),@Tb_Count) + ': ' + @Sp_Name
FETCH Next FROM staff_cursor Into @Sp_Name
END
print '总共删除' + CONVERT(varchar(20),@Tb_Count) + '个存储过程'
CLOSE staff_cursor -- 关闭游标
DEALLOCATE staff_cursor -- 释放游标资源