0

I'm new at Big Query and I created a column that has a reserved word in one of the tables:

enter image description here

Now that I'm trying to remove it by rewriting the table with a new query, I always get this error:

enter image description here

The syntax i'm using is this:

SELECT * EXCEPT(upsert, delete upsert) FROM 'table' LIMIT 1000

Yes, I created two columns with the names upsert and delete upsert. I couldn't find a way to rename the 'delete upsert' one to, at least 'delete_upsert', and I'm in a pickle, 'cause I don't want to create a new table because of that and lose historical data.

any thoughts that may help me? Thanks in advance! :)

  • I was able to remove the column 'upsert' using EXCEPT in a query, but not 'delete upsert' because it has a reserved word
  • My expectation is to remove these two columns completely from the table
Paul T.
  • 4,703
  • 11
  • 25
  • 29
  • Does adding backticks around the column name with the space help? – Paul T. May 12 '23 at 12:57
  • Hi! I tried that and I didn't work, I might have used the wrong type of ticks, though... I ended up selecting all the fields I wanted, saved in another table and deleted the original one, with the fields I wanted to delete. Not very efficient, but it did work ahah Thanks for the comment! :) – DataAnalytics_Rookie May 18 '23 at 15:04

1 Answers1

0

Quote them as with backticks. For example:

select `upsert` from t;

See Lexical structure and syntax.

The Impaler
  • 45,731
  • 9
  • 39
  • 76
  • Thank you for the link, I ended up selecting all of the fields I wanted and saving the results in a new table... less efficient, but worked just fine haha Thanks! – DataAnalytics_Rookie May 18 '23 at 15:06