sqlserver一次只能删除一个存储过程,如果多了,需要很长时间才能删完,所以写了一段语句,直接就把当然数据库下所有用户自定义的存储过程给drop了。不过使用都请留心,当前打开的数据库哦。下面贴代码
declare proccur cursor for select [name] from sysobjects where type='P' declare @procname varchar(100) open proccur fetch next from proccur into @procname while(@@FETCH_STATUS = 0) begin --exec('drop proc ' + @procname) --本句被注释,使用时请取消 print(@procname + '已被删除') fetch next from proccur into @procname end close proccur deallocate proccur