Updated on 2025-09-18 GMT+08:00

TRUNCATE

Function

TRUNCATE is specific to DataArts Fabric SQL. It is used to clear table data.

Precautions

External tables do not support TRUNCATE.

Iceberg tables do not support the TRUNCATE PARTITION syntax.

Syntax

1
TRUNCATE TABLE table_name [ PARTITIONS (col_name = col_value [, col_name = col_value ]) [, ... ] ];

Parameter Description

  • table_name

    Name of the target table whose data is to be cleared.

  • PARTITIONS

    If PARTITIONS is specified, only the data in the target partition is cleared.

  • col_name

    Partition column name.

  • col_value

    Partition data value.

Examples

Delete the data of the table partition whose ID is 2.

1
TRUNCATE TABLE table_name PARTITIONS (id = 2);