Tuesday, July 17, 2012

TRUNCATE vs DELETE in SQL


Reference from: http://codebetter.com/raymondlewallen/2005/05/09/the-difference-in-truncate-and-delete-in-sql-server/

TRUNCATE is faster because it does not physically delete the rows, but mark the rows as empty for reuse.

You cannot TRUNCATE  a table with foreign key constraints. You need to first remove the constraints, followed by a TRUNCATE and replace the constraints.

TRUNCATE will reset the identity columns.

No comments:

Post a Comment