Daniel Lee Daniel Lee - 8 months ago 45
SQL Question

Accessing a column named Cast in Bigquery

I have a table and one of the columns is named CAST. How can I access this column. I've tried

Select [Cast] AS cast_s FROM tablename
without success, Can I use this name or must I reimport all my data into bigquery?

I know that cast is a function. This is the error message:


Encountered " "CAST" "Cast "" at line 10, column 63. Was expecting: < E O F > (EOF has no spaces, markdown makes it disappear)



The lexical rules for BQ use backticks for this purpose:

select `cast` as cast_s
from tablename;

The documentation is here.