Question is pretty simple but just in case I'll explain it.
Is there a way to drop ALL the the assemblies in a Microsoft SQL Server?
I know that there's a way to delete them on at a time using
DROP ASSEMBLY ['assembly_name']; I never worked with assemblies but they should be in a structure within sys like everything else on SQL SERVER. I usually build massive commands by using a code similar to this one. Please note that within my environment all the tables related to assemblies are empty so I cannot say if the table and column I picked up with the select are correct, you will need to figure out on yourself.
declare @cmd NVARCHAR(MAX) set @cmd='' select @cmd=@cmd+ 'DROP ASSEMBLY [''' + am.assembly_class +'''];'+CHAR(13) from sys.assembly_modules am PRINT @cmd --Copy and paste the Messages content from SQL Server Management studio to a new query or uncomment the row below to execute --EXEC sp_executesql @cmd Note: this code does not allow for dependencies between assemblies, so you may have to run it 2-3 times before all assemblies are dropped.
/* Drop all assemblies */ DECLARE @SQL VARCHAR(MAX) DECLARE @name VARCHAR(128) DECLARE cur CURSOR FAST_FORWARD READ_ONLY FOR SELECT name FROM sys.assemblies WHERE is_user_defined=1 OPEN cur FETCH NEXT FROM cur INTO @name WHILE @@FETCH_STATUS = 0 BEGIN SELECT @SQL = 'DROP ASSEMBLY ' + RTRIM(@name) PRINT @SQL EXEC (@SQL) FETCH NEXT FROM cur INTO @name END CLOSE cur DEALLOCATE cur
sys.assemblies, I think it's available from version 2008 onwards. This table is scoped by database tho.