ankit kumar
what is the difference between Delete and Truncate command in SQL
Posted by ankit kumar in SQL Server on Jan 07, 2011
  • 0
  • 1
  • 5801
Do you know the answer for this question? Post it below.
Posted by ankit kumar on Jan 07, 2011
  • 0

<b>Delete</b> -is a logged operation on a per row basis , this means that the deletion of each row gets logged and physically deleted. You can delete any row that will not violate a constraint,while leaving the foreign key or any other constraint in place.<br><b>Truncate-</b><br>is also a logged operation but in different way.Truncate logs the deallocation of the data pages in which the data exists. The deallocation of&nbsp; data pages means that your data rows still actually<br>exists in the data pages but the extend have been marked as empty for&nbsp; reuse this is what makes truncate a faster operation over delete. you can not truncate a table that has any foreign key&nbsp; constraint . you will have to remove the constraint , truncate the table and reapply the <br>constraint..<br><br>

C# Corner Hyderabad Developer Conference

Most Popular Companies

Most Popular Job Functions