How to Cast a Column in Snowflake

Last updated July 24, 2026 · By the SaturnSQL team

Use CAST(col AS TYPE) or the :: shorthand. TRY_CAST returns NULL instead of erroring on bad values, which is the safe choice for messy string data.

The :: shorthand and CAST behave identically, so pick one and stay consistent. A cast that cannot succeed raises an error and fails the entire query rather than just the offending row, which is what makes it risky on data you have not validated.

SELECT CAST(amount AS INTEGER), amount::VARCHAR
FROM orders;

TRY_CAST for dirty data

TRY_CAST returns NULL instead of failing, letting the rest of the query complete. It only works when converting from a string type, so TRY_CAST on a numeric column is a syntax error. Pair it with a count of the NULLs it produces to measure how dirty the column actually is before deciding what to do.

SELECT TRY_CAST(user_input AS DATE) FROM raw_events; -- NULL when unparseable

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related Snowflake guides