Difference between DELETE and TRUNCATE command in SQL Server

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

Sl. No.

DELETE

TRUNCATE

1This 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
2This can be used with or without a Where clauseThis removes all rows from a table
3Can be rolled back.Cannot be rolled back
4It is a DML Command.It is a DDL Command.
5When an Identity is used , it is not resetIdentity is reset

 

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

One Response

  1. Albin Sunnanbo July 5, 2012 Reply

Leave a Reply


x

Interesting BlogPosts to read

Column Alias and Square brackets in SQL Query.
When we want to specify a alias for a column in SQL Query , we tend to use the double quotes or sing...
How to get the MAX row with group by in LINQ query using C# ?
Below is a sample code snippet demonstrating how to retreive the max row with the group by in LINQ Q...
Webinar - The Shortcomings of SQL for SharePoint Sync
Redmond Magazine is hosting a webinar on the topic "The Shortcomings of SQL for SharePoint Sync" on ...