Tuesday, 30 April 2013

Difference between Truncate and Delete

Truncate

1. Works at table level. That means locks are applied at table or page level, Not at row level.
2. Identity column is reset to seed value.
3. Can't apply filter on this command.
4. It is DDL Command.
5. Faster then delete as it does not log changes.

Delete

1. Works at row level. That means row level locks are applied.
2. Identity column is not reset.
3. Filters can be applied.
4. It is DML Command.
5. Slower as it logs each row deletion.

No comments:

Post a Comment