Pages

Men

rh

10/19/2013

Difference between Delete and Truncate in SQL Server

Delete:-

  • DELETE is a logged operation on a per row basis.  This means that the deletion of each row gets logged and physically deleted.
  • Delete statement can be specified with a condition.
  • Delete is a DML Command
  • Delete activates a trigger because the operation are logged individually.
  • Delete can be Rollback using logs.
  • Deleting is slower than truncate because, it keeps logs.


Truncate:-

  • TRUNCATE is also a logged operation, but in a different way. TRUNCATE logs the deallocation of the data pages in which the data exists.
  • Truncate statement can not specify with the condition.
  • Truncate is DDL Command
  • Truncate statement can activate trigger.
  • Truncate can not be Rollback.
  • Truncate is faster in performance wise, because it doesn't keep any logs.


No comments :

Post a Comment