Home > DeveloperSection > Interviews > Difference between TRUNCATE and DELETE commands?

Posted on    January-21-2013 2:04 AM

 MSSQL Server MSSQL Server 
 2 Answer(s)
  1775  View(s)
Rate this:


Total Post:257

Posted on    January-21-2013 1:00 AM

TRUNCATE is a DDL command whereas DELETE is a DML command.
DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back.
WHERE clause can be used with DELETE and not with TRUNCATE.

Shankar M

Total Post:3

Posted on    February-23-2013 1:00 AM

Truncate - DDL (Data Definition Language)  Statement 
Delete    - DML (Data Manipulation Language) Statement 

Both, perform the Operation of getting rid of rows in the Specified Table. But differs in the perspective of State,

When you issue Delete command for deleting Specific records in Table, Ignoringly you have deleted the wrong
set of records, then the Transaction can be rolled back, which simply implies that DELETE statements or DML operation can be roll backed to previous state.

Ex : When you issue a delete statement  which has a corresponding BEGIN TRANSACTION, Suppose the user disconnects then the Transaction is rollbacked.

Where as when considering DDL Statements they cannot be roll backed, Simply you might think of DDL statements as Auto commit.

Don't want to miss updates? Please click the below button!

Follow MindStick