mattberther.com » Drop all stored procedures
mattberther.com » Drop all stored procedures:
A useful script to drop all sprocs (prior to updating them all, for example)
USE myDatabase
GO
declare @procName sysname
declare someCursor cursor FOR
SELECT name FROM sysobjects WHERE type = 'P' AND objectproperty(id, 'IsMSShipped') = 0
open someCursor
fetch next FROM someCursor INTO @procName
while @@FETCH_STATUS = 0
begin
exec('drop proc ' + @procName)
fetch next FROM someCursor INTO @procName
end
close someCursor
deallocate someCursor
go
A useful script to drop all sprocs (prior to updating them all, for example)
USE myDatabase
GO
declare @procName sysname
declare someCursor cursor FOR
SELECT name FROM sysobjects WHERE type = 'P' AND objectproperty(id, 'IsMSShipped') = 0
open someCursor
fetch next FROM someCursor INTO @procName
while @@FETCH_STATUS = 0
begin
exec('drop proc ' + @procName)
fetch next FROM someCursor INTO @procName
end
close someCursor
deallocate someCursor
go
0 Comments:
Post a Comment
<< Home