Home >Database >Mysql Tutorial >删除所有存储过程

删除所有存储过程

WBOY
WBOYOriginal
2016-06-07 14:56:341396browse

删除所有存储过程的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  
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn