Wednesday 10 October 2012

TRUNCATE TABLE STATEMENT





We can delete all records from a table using “Truncate table” statement.

The “TRUNCATE TABLE” is a statement that quickly deletes all records in a table by deallocating the data pages used by the table. It bypasses the transaction log, and the only record of the truncation in the transaction logs is the page deallocation.

Syntax:
TRUNCATE TABLE <Table name>

Example:
TRUNCATE TABLE Sample_Table

Before Truncation:
select * from Sample_Table


After truncation:
select * from Sample_Table


No comments:

Post a Comment