Hi., here I would like give you explain a small difference what i have found between these two.
When we delete the data using delete command like DELETE FROM <TABLE NAME>.
Then all the records will delete from that table. but it an non logged operation. It will not effect to auto increment option.
Suppose we an auto increment option to our table for a primary key field. Let us take it as Id. So if we have data up-to id = 5 that means 5 records. if We delete the data using DELETE command and if we again enter the data into the table then it will the new id will be 6 only it will not start from the first. so the delete command will not effect to this field.
But when we truncate command we will have a new id from "1" . So this is called a logged operation.
Here in the below link you will find some more stuff of this issue.
Just Click Here
When we delete the data using delete command like DELETE FROM <TABLE NAME>.
Then all the records will delete from that table. but it an non logged operation. It will not effect to auto increment option.
Suppose we an auto increment option to our table for a primary key field. Let us take it as Id. So if we have data up-to id = 5 that means 5 records. if We delete the data using DELETE command and if we again enter the data into the table then it will the new id will be 6 only it will not start from the first. so the delete command will not effect to this field.
But when we truncate command we will have a new id from "1" . So this is called a logged operation.
Here in the below link you will find some more stuff of this issue.
Just Click Here
Another small difference is
After performing a DELETE operation you can do COMMIT or ROLLBACK
The Rows can be rollbacked(means undo the operation)
TRUNCATE removes all rows from a table. The operation cannot be rolled back
Yes you right anil thanks for adding some more information to this post.
This is really appreciable.
Indeed truncate is great choice for purging database and delete is great for transactional remove operation. see here for some more difference between truncate and delete in SQL