sp_droptype

Transact-SQL Reference

Transact-SQL Reference

sp_droptype

Deletes a user-defined data type from systypes.

Syntax

sp_droptype [ @typename = ] 'type'

Arguments

[@typename =] 'type'

Is the name of a user-defined data type that you own. type is sysname, with no default.

Return Code Type

0 (success) or 1 (failure)

Result Sets

None

Remarks

The type user-defined data type cannot be dropped if tables or other database objects reference it.

Note  A user-defined data type cannot be dropped if the user-defined data type is used within a table definition or if a rule or default is bound to it.

Permissions

Execute permissions default to members of sysadmin fixed server role, and the db_ddladmin and db_owner fixed database roles, and the data type owner.

Examples

This example drops the user-defined data type birthday.

Note  This user-defined data type must already exist or this example returns an error message.

USE master
EXEC sp_droptype 'birthday'

See Also

sp_addtype

sp_rename

System Stored Procedures