Skip to main content

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
└───────────────────────┘
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today