Truncate a table in GBQ

前端 未结 4 831
粉色の甜心
粉色の甜心 2021-02-02 11:21

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 b

4条回答
  •  清歌不尽
    2021-02-02 11:57

    While BigQuery didn't used to support anything other than SELECTs, 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.

提交回复
热议问题