Skip to main content

CAST, ::

Converts a value from one data type to another. :: is an alias for CAST.

See also: TRY_CAST

Syntax

CAST( <expr> AS <data_type> )

<expr>::<data_type>

Examples

SELECT CAST(1 AS VARCHAR), 1::VARCHAR;

┌───────────────────────────────┐
│ cast(1 as string)1::string │
├───────────────────┼───────────┤
11
└───────────────────────────────┘
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today