DIFFERENCE BETWEEN TRUNCATE AND DELETE COMMANDS?

AVADHESH PATEL

Total Post:257

Points:1285
Posted by  AVADHESH PATEL
 1809  View(s)
Ratings:
Rate this:
  1. AVADHESH PATEL

    Post:257

    Points:1285
    Difference between TRUNCATE and DELETE commands?

    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.

  1. Shankar M

    Post:3

    Points:15
    Difference between TRUNCATE and DELETE commands?

    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.


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!