欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

删除所有存储过程

程序员文章站 2022-05-21 09:14:36
...

删除所有存储过程的sql语句 无 DECLARE @procName VARCHAR(500)DECLARE cur CURSOR FOR SELECT [name] FROM sys.objects WHERE type = 'p'OPEN curFETCH next FROM cur INTO @procNameWHILE @@fetch_status = 0 BEGIN EXEC('drop procedure ' + @procName) FE

删除所有存储过程的sql语句
 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
      EXEC('drop procedure ' + @procName)

      FETCH next FROM cur INTO @procName
  END

CLOSE cur

DEALLOCATE cur