Returns the value of
sourceExpr cast to data type
targetType if possible, or NULL if not possible.
Since: Databricks Runtime 10.0
The result is of type
This function is a more relaxed variant of cast function which includes a detailed description.
try_cast differs from cast function by tolerating the following conditions as long as the cast from the type of
type is supported:
sourceExprvalue cannot fit within the domain of
targetTypethe result is
NULLinstead of an overflow error.
sourceExprvalue is not well formed or contains invalid characters the result is
NULLinstead of an invalid data error.
Exception to the above are: