All pastes #80375 Raw Edit

Anonymous

public sql v1 · immutable
·published 2006-07-06 10:43 UTC
rendered paste body
--AJ: Variable for the assembly we want to targetDECLARE @AssemblyName nvarchar(512) --AJ: Set the value for testing purposesSET @AssemblyName = 'premiersoftware.sqlserver.spaplus2, version=0.0.0.0, culture=neutral, publickeytoken=null, processorarchitecture=msil' --AJ: Declare our cursor--AJ: We just want the rows to read and at full pelt!DECLARE crs_CLRStoredProcs CURSOR FAST_FORWARD read_only FOR        (                --AJ: Define the rows we want                SELECT sys.procedures.name                FROM sys.procedures,                         sys.assembly_modules,                        sys.assemblies                WHERE sys.procedures.type = 'PC'                        AND sys.procedures.object_id = sys.assembly_modules.object_id                        AND sys.assembly_modules.assembly_id = sys.assemblies.assembly_id                        AND sys.assemblies.clr_name LIKE @AssemblyName        )  OPEN crs_CLRStoredProcs--AJ: For retriving the stroed proc namesDECLARE @StoredProcName nvarchar(256)--AJ: Retrive the stroed proc namesFETCH NEXT FROM crs_CLRStoredProcs INTO @StoredProcName--AJ: Make sure theres no errorsWHILE @@fetch_status = 0        BEGIN        PRINT 'DROP PROCEDURE ' + @StoredProcNameFETCH NEXT FROM crs_CLRStoredProcs INTO @StoredProcName <---------- DOH!        END --AJ: Clean up after ourselvesCLOSE crs_CLRStoredProcsDEALLOCATE crs_CLRStoredProcs--SELECT *--FROM sys.assemblies