Monday, March 16, 2009

What is the difference between delete and truncate command?

Delete command remove the rows from table based on the condition provided in where clause. Truncate will remove all the data from table. After deleting we can rollback but after truncate we can’t rollback.
The other main difference are below:-

a) Truncate is DDL command while DELETE is DML command.
b) TRUNCATE resets the identity of the tables while DELETE doesn’t reset the identity of the table.
c) TRUNCATE can not be rolled back while delete can be rolled back.

No comments:

Post a Comment

c4 Code