H2 Database - Truncate



TRUNCATE is a command used to delete the data from the table. Unlike DELETE FROM without WHERE clause, this command cannot be rolled back. This command commits an open transaction in this connection.

Syntax

Following is the generic syntax of the truncate command.

TRUNCATE TABLE tableName 

Example

In this example, we will truncate a table named test using the following query.

TRUNCATE TABLE test;

The above query produces the following output.

(6) row (s) effected 
Advertisements