1 --使用游标批量删除Sql Server对象
 2 DECLARE cursorname cursor for select 'drop PROCEDURE  '+name from sys.objects where name like 'xx%' and type = 'p' --删除对应的存储过程
 3 DECLARE cursorname cursor for select 'drop Trigger'+name from sys.objects where name like 'xx%' and type = 'tr' --删除对应的触发器
 4 
 5 open cursorname
 6 declare @curname sysname
 7 fetch next from cursorname into @curname
 8 while(@@fetch_status=0)
 9   begin
10 exec(@curname)
11 fetch next from cursorname into @curname
12 end
13 close cursorname
14 deallocate cursorname

 

相关文章:

  • 2021-06-07
  • 2022-12-23
  • 2021-07-31
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2021-06-01
  • 2022-01-02
  • 2021-09-26
  • 2021-06-25
相关资源
相似解决方案