I’m working in Microsoft SQL Server Management Studio CLR registering .dlls into the database as assemblies. Right now, I’m registering Jayrock (Jayrock.dll, Jayrock.Json.dll) DLLs into the database. This is an ongoing project that has had a few people editing the database and SQL code. I dropped all of the assemblies and procedures that had been altered (and Unaltered) to start from square one. When I went to drop the assembly for “web” (code below)
CREATE ASSEMBLY Web
AUTHORIZATION dbo
FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'
WITH PERMISSION_SET = UNSAFE
GO
I got the error message:
DROP ASSEMBLY failed because the specified assemblies are referenced by assembly 'Jayrock.Json'.
I never had an assembly named Jayrock.Json and no one on my team created such an assembly. Attempting to drop it gets the error message from this question’s title:
drop assembly Jayrock.Json
go
"DROP ASSEMBLY" does not allow specifying a schema name as a prefix to the assembly name.
I added ‘ ‘ and ( ) which still didn’t allow me to drop this assembly. I have dropped ALL assemblies that were created but “Web” still won’t drop. I’m not quite sure what I can do because creating the assembly I need to use Jayrock doesn’t work because it is identical to the ‘Jayrock.Json’ assembly. There is some kind of bug in my code because I am getting exceptions from C# related to deserialization and missing assemblies that I can’t debug if I can’t get my assemblies added properly.
Run the following and look to see if you have an assembly named “Jayrock.Json”.
If you do, like Martin Smith said in his comment, you need to put [] around the object name in the DROP statement.