ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,jQuery Plugins,jQuery UI,SSRS,XML,HTML,jQuery demos,code snippet examples.

Breaking News

  1. Home
  2. sql
  3. Difference between Delete and Truncate

Difference between Delete and Truncate

Both Delete and Truncate is SQL command used to delete records from the table. Their functionalities are almost same, but have some difference which can arise confusion. This article describes the difference between Delete and Truncate command. Summary of the article:
  • What is Delete Command?
  • What is Delete Truncate ?
  • Delete VS Truncate
What is Delete Command?
Delete is a SQL command that is used to delete records from the table in a database. A sample example of SQL Delete command is given bellow:
DELETE FROM Marks
WHERE ID=2
What is Truncate Command?
Truncate is a SQL command that is used to delete records from the table in a database. A sample example of SQL Truncate command is given bellow:
TRUNCATE TABLE Marks
Delete VS Truncate
Delete and Truncate command has some differences. The differences between Delete and Truncate are given bellow:
Delete
  1. It is slow
  2. It keeps log for every row
  3. We can use where clause
  4. It delete all data based on where clause
Truncate
  1. It is faster
  2. It does not keeps log
  3. We can’t use where clause
  4. It delete all data
So, don’t be confused on Delete and Truncate. One should have clear concept on SQL commands. Unless it may arise problems.

No comments