Export (0) Print
Expand All
Expand Minimize

DROP TYPE (Transact-SQL)

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Removes an alias data type or a common language runtime (CLR) user-defined type from the current database.

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.

Topic link icon Transact-SQL Syntax Conventions

DROP TYPE [ schema_name. ] type_name [ ; ]

schema_name

Is the name of the schema to which the alias or user-defined type belongs.

type_name

Is the name of the alias data type or the user-defined type you want to drop.

The DROP TYPE statement will not execute when any of the following is true:

  • There are tables in the database that contain columns of the alias data type or the user-defined type. Information about alias or user-defined type columns can be obtained by querying the sys.columns or sys.column_type_usages catalog views.

  • There are computed columns, CHECK constraints, schema-bound views, and schema-bound functions whose definitions reference the alias or user-defined type. Information about these references can be obtained by querying the sys.sql_expression_dependencies catalog view.

  • There are functions, stored procedures, or triggers created in the database, and these routines use variables and parameters of the alias or user-defined type. Information about alias or user-defined type parameters can be obtained by querying the sys.parameters or sys.parameter_type_usages catalog views.

Requires either CONTROL permission on type_name or ALTER permission on schema_name.

The following example assumes a type named ssn is already created in the current database.

DROP TYPE ssn ;
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft