Wednesday, March 6, 2013

Truncate and Delete command

Truncate and Delete command in SQL Server

DELETE
TRUNCATE
DDL command
DML command
Used delete all or selected rows from a table based on WHERE clause.
Removes all rows from a table.
This is a logged operation for every row.
This is also a logged operation but in terms of deallocation of data pages.
Any row not violating a constraint can be Deleted.
Cannot TRUNCATE a table that has foreign key constraints.
Need to Commit or Rollback
Cannot be Rolled back.
Does not reset the identity column. Starts where it left from last.
Resets identity column to the default starting value.

No comments: