Interviews - C# Corner

ankit kumar
what is the difference between Delete and Truncate command in SQL
By ankit kumar in SQL Server on Jan 07 2011
  • ankit kumar
    Jan, 2011 7

    <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>

    • 0

Most Popular Companies

Most Popular Job Functions