Skip to content

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

See also: CAST

func.try_cast( <expr>, <data_type> )
func.try_cast(1, string)
┌──────────────────────────┐
│ func.try_cast(1, string) │
├──────────────────────────┤
1
└──────────────────────────┘
TRY_CAST( <expr> AS <data_type> )
SELECT TRY_CAST(1 AS VARCHAR);
┌───────────────────────┐
try_cast(1 as string) │
├───────────────────────┤
1
└───────────────────────┘