Friday, August 17, 2012

SQL SERVER- What is Similarity and Difference between Truncate and Delete in SQL Server

Most Common question  in Interview purpose -

Similarity

      1. These both command will only used for delete data of the specified table.

Difference

1.      TRUNCATE is a DDL (data definition language) command whereas DELETE is a DML (data manipulation language) command. 

2.      We can’t execute a trigger in case of TRUNCATE whereas with DELETE command, we can execute a trigger.

3.      We can apply condition on DELETE whereas can’t apply on TRUNCATE.

4.      TRUNCATE remove the reference like Identity whereas DELETE isn’t.

5. DELETE Stmt delete record one by one whereas TRUNCATE remove all recods in one attempt. 

Like and Share to SQL Integrity Blog

No comments:

Post a Comment

Thank You !!!!