string
function
Applies to: Databricks SQL Databricks Runtime
Casts the value expr
to STRING
. This function is a synonym for cast(expr AS STRING)
. See cast function for details.
Syntax
string(expr)
Arguments
expr
: An expression that can be cast toSTRING
.
Returns
A STRING
.
If expr
is not a STRING
, the result STRING
is assigned the default collation.
Otherwise, the result collation matches the collation of expr
.
Examples
> SELECT string(5);
5
> SELECT string(current_date);
2021-04-01