📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

TRY_CAST



Converts a value from one data type to another. Returns NULL on error.

See also: CAST

Syntax

TRY_CAST( <expr> AS <data_type> )

Examples

SELECT TRY_CAST(1 AS VARCHAR); ┌───────────────────────┐ │ try_cast(1 as string) │ ├───────────────────────┤ │ 1 │ └───────────────────────┘

Was this page helpful?