Platinum Partner
dotnet,sql server,tips and tricks

Difference between DELETE and TRUNCATE command in SQL Server

Below are few points that differentiate the DELETE and TRUNCATE command.

Sl. No.

DELETE

TRUNCATE

1 This removes the rows one at a time and then records it in the transaction log for each of those deleted row. This used fewer transaction log than delete and is faster
2 This can be used with or without a Where clause This removes all rows from a table
3 Can be rolled back. Cannot be rolled back
4 It is a DML Command. It is a DDL Command.
5 When an Identity is used , it is not reset Identity is reset

 

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}