Blob types can be cast to varchars. This will produce a string of up to 16 MB in length and an error for longer blobs.

Nothing can be cast to a blob type. Blobs only come from selecting blob columns and are created by assigning values to such columns.

Converting non-integer values to integers rounds towards 0.

Any data type can be converted to binary with the VARBINARY target data type. The result may or may not be meaningful. Specifically datetime can be converted to binary and back.

cast_expression :
                CAST '(' scalar_exp AS data_type [COLLATE collation_name ] ')'

collation_name :
        identifier
        | owner '.' identifier
        | qualifier '.' owner '.' identifier

The CAST expression converts the type of the scalar_exp into the data_type, if possible. If the conversion is not meaningful, as from a float to a date, an error is signalled.

CAST is the recommended way of converting between data types, including any conversion between strings, different number types and datetime types.

Example 9.1. Examples:

select cast ('2000-1-3' as date);

select cast (cast ('2000-1-3' as date) as varchar);
        = 2000-01-03 00-00-00 000000