CAST AS NUMERIC 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 NUMERIC) AS Emp_Id;

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

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

nVector

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