SQL Server批量删除存储过程

 1 declare proccur cursor
 2 for
 3 select [name] from sysobjects where type='P' and [name] like '%废%'
 4 declare @procname varchar(100)
 5 open proccur
 6 fetch next from proccur into @procname
 7 while(@@FETCH_STATUS = 0)
 8 begin 
 9 exec('drop proc ' + @procname) 
10 print(@procname + '已被删除')
11 fetch next from proccur into @procname
12 end
13 close proccur
14 deallocate proccur

 

posted @ 2019-12-09 10:23  IT小丑  阅读(511)  评论(0编辑  收藏  举报