DEV Community 👩‍💻👨‍💻

Cover image for Eliminar todos los procedimientos almacendos con un sentencia SQL Server.
Darwing  Castellanos
Darwing Castellanos

Posted on

Eliminar todos los procedimientos almacendos con un sentencia SQL Server.

Debemos tener seleccionada la base de datos o usar especificame el comando:

use nombredatabase;

Enter fullscreen mode Exit fullscreen mode
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

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.