TRY_CAST
Converts a value from one data type to another. Returns NULL on error.
See also: CAST
Analyze Syntax
func.try_cast( <expr>, <data_type> )
Analyze Examples
func.try_cast(1, string)
┌──────────────────────────┐
│ func.try_cast(1, string) │
├──────────────────────────┤
│ 1 │
└──────────────────────────┘
SQL Syntax
TRY_CAST( <expr> AS <data_type> )
SQL Examples
SELECT TRY_CAST(1 AS VARCHAR);
┌───────────────────────┐
│ try_cast(1 as string) │
├───────────────────────┤
│ 1 │
└───────────────────────┘
Last modified April 24, 2024 at 10:11 PM EST: updating conversion functions (833d7a5)