Go Back

TRUNCATE TABLE: Remove all data from a table but retain its structure

Tue Mar 05 2024 19:41:19 GMT+0000 (Coordinated Universal Time)
All Articles

#TRUNCATE TABLE: Remove all data from a table but retain its structure

TRUNCATE table in Sql

Because TRUNCATE TABLE only dealslocates the data pages the table uses—without noting specific row deletions—it is significantly faster.

TRUNCATE TABLE table_name;

Just replace table_name with the name of the table you want to truncate. Be careful when using TRUNCATE TABLE because it removes all data from the specified table and cannot be undone. Additionally, it may reset any auto-incremented primary key columns back to their starting values.

showing an illustration of TRUNCATE TABLE: Remove all data from a table but retain its structure   and <p>#TRUNCATE TABLE: Remove all data from a table but retain its structure </p>

Article