CAST
function or operator are used to explicitly convert a value from one data type into a another data type.
BOOLEAN
:
integral_types
can be converted. Note that all integers except 0 are converted to ‘true’. Zero is converted to ‘false’.VARCHAR(max)
.expression
The expression can be a constant or a column or any expression that resolves to a single value.
target_type
The target_type is the data type to which you want to convert the above expression to, as long as it is
qualified as a valid convert.
DATE
into TIMESTAMP
:
2022-12-12 00:00:00
. Note that the time was added.
Convert literal representing an INT
into STRING
:
numeric_type
into DECIMAL
:
o_date
into TIMESTAMP
: