In BigQuery Legacy Sql, we can cast Integer column to float type using float() function.
What is its equivalent in BigQuery Standard Sql? I have tried these commands:
I have tried these commands:
SELECT float( author.time_sec ) FROM bigquery-public-data.github_repos.commits
LIMIT 1000
SELECT cast( author.time_sec as float) FROM bigquery-public-data.github_repos.commits
LIMIT 1000
Both of them failed.
BigQuery Data Types: NUMERIC Integer(INT 64): Represents numbers within the range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 and numbers that do not have fractional components. Float (Float 64): Numbers with approximate numeric values and fractional components.
Standard SQL supports the CAST
function with the FLOAT64
data type, e.g.:
SELECT CAST(author.time_sec as FLOAT64)
FROM `bigquery-public-data.github_repos.commits`
LIMIT 1000;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With