TRY_CAST
Convert a value to another data type, returning a missing value if conversion fails.
Try an expression
In Formula, enter the expression and set Output type to DOUBLE.
Example input
- Row 1
amount = '12.5' - Row 2
amount = 'unknown' - Row 3
amount = NULL
Expression
TRY_CAST(amount AS DOUBLE)Result
Row 1: 12.5
Row 2: NULL
Row 3: NULLNULL means the value is missing.
Arguments and types
TRY_CAST(expr AS type)The result type can depend on the input types. See DuckDB for the full argument rules.
Function metadata from DuckDB, used under the MIT license.