create procedure dropprocedure
as declare cur cursor
read_only
for select name from sysobjects where xtype='p' and name like 'drop%'
declare @name varchar(40),@sql varchar(1000)
open cur
fetch next from cur into @name
while (@@fetch_status =0)
begin
set @sql ='drop procedure ' + @name
exec (@sql)
fetch next from cur into @name
end
close cur
deallocate cur
go dropprocedure
2.
declare del_cursor cursor
forselect 'drop procedure ' + name from dbo.sysobjects where objectproperty(id, n'isprocedure') = 1 and name not like 'usp_blog%'
open del_cursor
declare @curname sysname
fetch next from del_cursor into @curname
while(@@fetch_status=0)
begin
exec(@curname)
fetch next from del_cursor into @curname
endclose del_cursor
deallocate del_cursor
批量刪除的儲存過程
批量刪除的儲存過程 根據批量刪除的sql語句可以知道 delete table where id in id1,id2,id3,寫儲存過程 create proc up del id nvarchar 20 asdelete table where id in id 此時執行會報 訊息 245,級別...
SQL SERVER 批量刪除儲存過程
sqlserver 2005一次只能刪除乙個儲存過程,如果多了,需要很長時間才能刪完,所以寫了一段語句,直接就把當然資料庫下所有使用者自定義的儲存過程給drop了。不過使用都請留心,當前開啟的資料庫哦。下面貼 declare proccur cursor forselect name from sy...
批量刪除記錄的儲存過程
if exists select from sysobjects where name users delete drop proc users delete gocreate proc users delete id varchar 100 asdeclare pointprve int 開始的位...