22 Sep 19 · npack ·       Add to Favorites  

CAST AS INT64 syntax in Google Bigquery

Cast syntax is used in a query to indicate that the result type of an expression should be converted to some other type

SELECT CAST("123" AS INT64) AS Emp_Id;

You can also do a SAFE_CAST to handle run time errors due to invalid input expression:

SELECT CAST("apple" AS INT64) AS not_a_number;
+--------------+
| not_a_number |
+--------------+
| NULL |
+--------------+

npack

posted on 22 Sep 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds

Copied