Msg 6590, Level 16, State 1, Procedure procedure_name, Line 25
DROP ASSEMBLY failed because 'testi' is referenced by object 'test_wi'
when you are trying to drop assembly but it's dependent object exists in database you will get error:
Drop assembly assembly_name; Msg 6590, Level 16, State 1, Line 1 DROP ASSEMBLY failed because 'testi' is referenced by object 'test_wi'.
Solution:
With this query you can find dependent objects
SELECT A.assembly_id,A.name as [Assembly Name], B.object_id, C. name as [Object Name], C.type, C.type_desc FROM Sys.Assemblies A INNER JOIN SYS.ASSEMBLY_MODULES B oN a.assembly_id=B.assembly_id INNER JOIN SYS.OBJECTS C ON B.object_id = C.object_idin the above result set, you have the assembly name along with its dependent's objects names (CLR functions).
So you can drop CLR functions and then drop Assembly.
You cannot drop assembly without dropping its object. Preferably, you should alter the assembly not to drop. But if you need to drop, first drop all its objects and then you can drop Assembly.
No comments:
Post a Comment