DROP CAST statement
Use the DROP CAST statement to remove an existing cast from the database.
This statement is an extension to the ANSI/ISO standard for SQL.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
source_type | Data type that the cast accepts as input | Must exist | Identifier; Data Type |
target_type | Data type returned by the cast | Must exist | Identifier; Data Type |
Usage
A cast defined on a given data type can also be used on any DISTINCT types created from that source type. If you drop the cast, you can no longer invoke it for the DISTINCT types, but dropping a cast that is defined for a DISTINCT type has no effect on casts for its source type. When you create a DISTINCT type, the database server automatically defines an explicit cast from the DISTINCT type to its source type and another explicit cast from the source type to the DISTINCT type. When you drop the DISTINCT type, the database server automatically drops these two casts.
If you include the optional IF EXISTS keywords, the database server takes no action (rather than sending an error to the application) if no cast between the two specified data types is registered in the current database.
Example
DROP CAST (decimal(5,5) AS percent);
Details
of existing casts can be found in the syscasts system catalog
table the following SQL: SELECT routine_name, class, argument_type, result_type FROM Syscasts;