The below are the differences between Truncate and Delete .
S.No |
Truncate |
Delete |
1 |
Is
DDL Command |
Is
DML Command |
2 |
Truncate
is faster |
Delete
is comparatively slower |
3 |
Removes
all rows from a table |
Can
remove specific rows with Where clause |
4 |
Resets
identity of the table |
Does
not reset identity of the table |
5 |
Removes
the data by deallocating the data pages and logs the deallocation. |
Removes
one row at a time and records an entry in the transaction log for each deleted row. |
6 | Cannot be rolled back | Can be rolled back |
Great explanation for the difference .
ReplyDelete