Truncate a table in GBQ

前端 未结 4 830
粉色の甜心
粉色の甜心 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 12:09

    CREATE OR REPLACE TABLE .
    AS SELECT * FROM .
    LIMIT 0;

    For partitionned tables, assuming you have a day partition on field "created_on", then execute the following :

    CREATE OR REPLACE TABLE .
    PARTITION BY created_on AS SELECT * FROM .
    WHERE created_on = CURRENT_DATE() LIMIT 0;

    提交回复
    热议问题