刪除儲存過程

2021-05-01 01:42:01 字數 398 閱讀 5328

declare @procname varchar(500)

declare cur cursor

for select [name] from sys.objects where type = 'p'

open cur

fetch next from cur into @procname

while @@fetch_status = 0

begin

if @procname <> 'deleteallprocedures'

exec('drop procedure ' + @procname)

fetch next from cur into @procname

endclose cur

deallocate cur

刪除儲存過程

儲存過程可以被快速刪除和重建,因為它沒有儲存資料。刪除儲存過程可以使用sql server管理平台和transac sql語句。1.使用sql server管理平台刪除儲存過程 操作步驟如下 1 開啟sql server管理平台,展開結點 物件資源管理器 資料庫伺服器 可程式設計性 儲存過程 選擇要...

批量刪除儲存過程的儲存過程

create procedure dropprocedure as declare cur cursor read only for select name from sysobjects where xtype p and name like drop declare name varchar 4...

通用的更新儲存過程和刪除儲存過程

create procedure productsortdel id int,a tablename varchar 30 as declare sql varchar 200 set sql delete from a tablename where id cast id as varchar e...