.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Articles >> DataBase >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Difference between DELETE and TRUNCATE Command

Posted By:Athira Sreejith       Posted Date: December 31, 2008    Points: 15    Category: DataBase    URL: http://www.dotnetspark.com  

Difference between DELETE and TRUNCATE Command

Delete command removes the rows from a table based on the condition thate we provide with a WHERE clause.Truncate will actually remove all the rows from a table and there will be no data in the table after we can run the truncate command.


1) Truncate is faster and uses fewer system and transaction log resources than Delete.

2) Truncate removes the data by deallocationg the data pages used to store the tables's
data,and only the page deallocations are recorded in the transaction log.

3) Truncate removes all rows froma table ,but the table structure and its columns ,constraints ,indexes and so on remain.The counter used by an idetity for new rows is reset to the seed for the column.

4) You cannot use Truncate table on a tbale referenced by a Foreign key constant.Because Truncate table is not logged,it cannot activate a trigger.

5) Truncate cannot be rolled back.

6) Truncate is dll command.

7) Truncate resets identity of the table.


1) Delete removes rows one at a time and records an entry in the transaction log for each deleted row.

2) If you want to retain the identity counter,use delete instead.If u want to remove table definition and its data,use the DROP TABLE statement.

3) Delete can be used with or without a WHERE clause.

4) Delete activate triggers.

5) Delete can be rolled back.

6) Delete is DML command.

7) Delete does not reset identity of the table

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend