--- title: "Dropping an Assembly | Microsoft Docs" ms.custom: "" ms.date: "03/14/2017" ms.prod: sql ms.reviewer: "" ms.technology: clr ms.topic: "reference" helpviewer_keywords: - "removing assemblies" - "DROP ASSEMBLY statement" - "assemblies [CLR integration], removing" - "dropping assemblies" ms.assetid: 03481034-dc91-4488-ab24-ba44243e2690 author: "rothja" ms.author: "jroth" --- # Dropping an Assembly [!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md](../../../includes/appliesto-ss-xxxx-xxxx-xxx-md.md)] Assemblies that have been registered in [!INCLUDE[ssNoVersion](../../../includes/ssnoversion-md.md)] using the CREATE ASSEMBLY statement can be deleted, or dropped, when the functionality they provide is no longer needed. Dropping an assembly removes the assembly and all of its associated files, such as debug files, from the database. To drop an assembly, use the DROP ASSEMBLY statement with the following syntax: ``` DROP ASSEMBLY MyDotNETAssembly ``` DROP ASSEMBLY does not interfere with any code referencing the assembly that is currently running, but after DROP ASSEMBLY executes, any attempts to invoke the assembly code fail. DROP ASSEMBLY returns an error if the assembly is referenced by another assembly that exists in the database, or if it is used by common language runtime (CLR) functions, procedures, triggers, user-defined types (UDTs), or user-defined aggregates (UDAs) in the current database. First use the DROP AGGREGATE, DROP FUNCTION, DROP PROCEDURE, DROP TRIGGER, and DROP TYPE statements to delete any managed database objects contained in the assembly. ## Removing a UDT from the Database The DROP TYPE statement removes a UDT from the current database. Once a UDT is dropped, you can use the DROP ASSEMBLY statement to drop the assembly from the database. The DROP TYPE statement fails if objects depend on the UDT, as in the following situations: - Tables in the database that contain columns defined using the UDT. - Functions, stored procedures, or triggers that use variables or parameters of the UDT, created in the database with the WITH SCHEMABINDING clause. ### Finding UDT Dependencies You must first drop all dependent objects, and then execute the DROP TYPE statement. The following [!INCLUDE[tsql](../../../includes/tsql-md.md)] query locates all of the columns and parameters that use a UDT in the **AdventureWorks** database. ``` USE Adventureworks; SELECT o.name AS major_name, o.type_desc AS major_type_desc , c.name AS minor_name, c.type_desc AS minor_type_desc , at.assembly_class FROM ( SELECT object_id, name, user_type_id, 'SQL_COLUMN' AS type_desc FROM sys.columns UNION ALL SELECT object_id, name, user_type_id, 'SQL_PROCEDURE_PARAMETER' FROM sys.parameters ) AS c JOIN sys.objects AS o ON o.object_id = c.object_id JOIN sys.assembly_types AS at ON at.user_type_id = c.user_type_id; ``` ## See Also [Managing CLR Integration Assemblies](../../../relational-databases/clr-integration/assemblies/managing-clr-integration-assemblies.md) [Altering an Assembly](../../../relational-databases/clr-integration/assemblies/altering-an-assembly.md) [Creating an Assembly](../../../relational-databases/clr-integration/assemblies/creating-an-assembly.md) [DROP AGGREGATE (Transact-SQL)](../../../t-sql/statements/drop-aggregate-transact-sql.md) [DROP FUNCTION (Transact-SQL)](../../../t-sql/statements/drop-function-transact-sql.md) [DROP PROCEDURE (Transact-SQL)](../../../t-sql/statements/drop-procedure-transact-sql.md) [DROP TRIGGER (Transact-SQL)](../../../t-sql/statements/drop-trigger-transact-sql.md) [DROP TYPE (Transact-SQL)](../../../t-sql/statements/drop-type-transact-sql.md)