Request a demo

BigQuery reference

BigQuery conversion functions

Conversion functions change a value from one type to another. CAST fails the whole query on a bad value; SAFE_CAST returns NULL instead, which is usually what you want on raw data.

Functions in this category

FunctionWhat it does
CASTCAST(expression AS type) converts a value to another data type, such as STRING to INT64 or TIMESTAMP to DATE, and fails the whole query if any value can't be converted.
PARSE_NUMERICPARSE_NUMERIC(string) converts a STRING to NUMERIC and, unlike CAST, accepts thousands separators, spaces and a trailing minus sign, as in '1,234.50' or '75.10-'.
SAFE_CASTSAFE_CAST(expression AS type) works like CAST but returns NULL instead of failing when a value can't be converted.

More of the BigQuery reference

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.