Hi
What is Similarity and Difference between Truncate and Delete in SQL ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jul 20, 2012, 6:12 AM
Both used for removing Data from Data base.
Diffrence :
DELETE is a logged operation on a per row basis. TRUNCATE is also a logged operation, but in a different way. TRUNCATE logs the deallocation of the data pages in which the data
exists.
You cannot TRUNCATE a table that has any foreign key constraints , but you can DELETE those record.
TRUNCATE will reset any identity columns to the default seed value whereas DELETE is not.
TRUNCATE does not contain Where condition whereas DELETE has
Truncate Table is faster than Delete Table,
Truncate Table cannot activate a trigger.
hope this will help you.
Satyapriya NayakPosted Jul 20, 2012, 6:11 AM
Rahul BhattPosted Jul 20, 2012, 5:56 AM
Diffrence ::
1. Delete :: Allowed Condition based Delete. (Use where clause)
Trunacter:: not allowed condition based Delete
2. Delete :: Rollback Data
Truncate :: not to rollback