DECLARE @procedureName varchar(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.procedures WHERE type in ('p', 'fn') and is_ms_shipped=0 and name not like 'sp[_]%diagram%'
OPEN cur
FETCH NEXT FROM cur INTO @procedureName
WHILE @@fetch_status = 0
BEGIN
EXEC('DROP PROCEDURE ' + @procedureName)
--select @procedureName
FETCH NEXT FROM cur INTO @procedureName
END
CLOSE cur
DEALLOCATE cur
How to write code in C#, Asp.Net, Php, Javascript, C. On this blog you will find example codes that will help you to understand concepts of programming.
Thursday, June 7, 2012
How to delete procedures, user functions or views from a database in SQL?
In order to delete all functions, procedures or views from a database you can help yourself by using this query:
Labels:
SQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment