I have one to drop stored procedures, udfs, views, and triggers. It only does the drop for very specific prefixes in the objects names though. Here it is:SET NOCOUNT ONDECLARE @objName varchar(80)DECLARE @objType char(2)DECLARE cur CURSOR FOR SELECT name, typeFROM SYSOBJECTS WHERE ( (type = 'P' AND (name LIKE 'usp[_]%' OR name like 'isp[_]%')) OR (type = 'FN' AND name LIKE 'udf[_]%') OR (type = 'TF' AND name LIKE 'udf[_]%') OR (type = 'U') OR (type = 'V' AND name LIKE 'v[_]%') OR (type = 'TR') ) AND uid = 1 AND status > -1OPEN cur FETCH NEXT FROM cur INTO @objName, @objTypeWHILE @@FETCH_STATUS = 0BEGIN IF @objType IN ('TF', 'FN') EXEC ('DROP FUNCTION dbo.' + @objName) IF @objType = 'P' EXEC ('DROP PROC dbo.' + @objName) IF @objType = 'V' EXEC ('DROP VIEW dbo.' + @objName) IF @objType = 'TR' EXEC ('DROP TRIGGER dbo.' + @objName) FETCH NEXT FROM cur INTO @objName, @objTypeENDCLOSE cur DEALLOCATE cur GO
Perhaps you can modify it to your liking.Tara Kizeraka tduggan