Truncate table | SQL Tutorial and Query Example

Text copied!

Truncate table


  • Here's an example of how to truncate table using T-SQL :

    1. "TRUNCATE TABLE" statement is used to delete all table data in a database. Here's syntax :

    TRUNCATE TABLE table_name;
            
    Truncate table
    TRUNCATE TABLE [Product];
            
    Truncate table Truncate table

    Frequently Asked Questions :

    Truncate table removes all rows from a table in SQL, but the table structure remains intact.
    Truncate table in SQL quickly deletes all rows from a table without logging individual row deletions.
    The key difference between DELETE and truncate is that DELETE removes rows one by one and logs each deletion, while truncate instantly removes all rows without logging.
    The syntax of truncate table in SQL typically involves the command "TRUNCATE TABLE" followed by the table name.