Different between delete and truncate command in sql?
Loading
Different between delete and truncate command in sql?
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.
Rajanikant HawaldarPosted Oct 17, 2022, 10:38 AM
Brahma Prakash ShuklaPosted Oct 17, 2022, 3:54 PM
TRUNCATE and the DELETE statement both come under SQL query for delete operation. They perform deletion operations on unwanted records or rows of a table. In the DELETE statement, the rows from the table get deleted with a condition. In simple words, one or more rows can be deleted at once. but in the TRUNCATE command, all the rows get deleted at once.
When we use the DELETE query, a log is created for every row in the transaction log. This way we can get back the records using ROLLBACK before COMMIT. Also, when using TRUNCATE, we can get the records back using ROLLBACK. The difference is that TRUNCATE only logs the deallocation of the page where data is stored.
Jignesh KumarPosted Oct 17, 2022, 10:45 AM
Please refer these link which has good informatice details,
https://www.c-sharpcorner.com/blogs/difference-between-truncate-delete-and-drop-in-sql-server1
https://www.mssqltips.com/sqlservertip/4248/differences-between-delete-and-truncate-in-sql-server/