教您如何使用sql语句删除所有存储过程


  本文标签:SQL 删除

  如果存储过程不需要了,该如何删除呢?下面将教您如何使用sql语句删除所有存储过程,供您参考,如果您不知道如何写这样的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

  if @procName <> DeleteAllProcedures

  exec(drop procedure + @procName)

  fetch next from cur into @procName

  end

  close cur

  deallocate cur