Delete Vs Truncate | SansSQL

Wednesday, June 26, 2013

Delete Vs Truncate

Delete Truncate
Delete is DML Command Truncate is a DDL Command.
Delete Operation will not Reset Identity property of the column Truncate Operation will Reset the Identity Property to the seed value that is defined for the column
Filters can be specified for Delete Operation (Where Condition) Filters cannot be specified for Truncate Operation
Delete can be rolled back Truncate can be rolled back if used within a Transaction
Delete statement uses row lock and each row is locked for deletion Truncate statement uses Table or page Lock
Delete Operation is slower when compared to truncate because it logs an entry in transaction log for each deletion Truncate Operation is faster because it is minimally Logged in transaction Log 
Delete statements can activate triggers when defined Triggers cannot be defined for Truncate Operation

No comments:

Post a Comment