I am trying to truncate an existing table in GBQ but the below command fails when I run it. Is there any specific command or syntax to do that. I looked into GBQ documentation but no luck.
TRUNCATE TABLE [dw_test.test];
While BigQuery didn't used to support anything other than SELECT
s, it now does as long as you uncheck "Use Legacy SQL" in the query options. There is no truncation, but you can delete:
DELETE from my_table WHERE 1=1
Note that BigQuery requires the use of WHERE
in the DELETE
, so if you want to delete everything you need to use a statement that will always be true.