TRY_CAST (Lakehouse v1)
Converts a value from one data type to another. Returns NULL on error.
See also: CAST
Analyze Syntax
Section titled “Analyze Syntax”func.try_cast( <expr>, <data_type> )Analyze Examples
Section titled “Analyze Examples”func.try_cast(1, string)
┌──────────────────────────┐│ func.try_cast(1, string) │├──────────────────────────┤│ 1 │└──────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TRY_CAST( <expr> AS <data_type> )SQL Examples
Section titled “SQL Examples”SELECT TRY_CAST(1 AS VARCHAR);
┌───────────────────────┐│ try_cast(1 as string) │├───────────────────────┤│ 1 │└───────────────────────┘