SQL TRUNCATE TABLE Command – Don’t use DELETE when you don’t have to

By | 13. 12. 2019

T-SQL TRUNCATE command deletes all records in the table. Apart from DELETE (more in article SQL DELETE) command, there is no possibility to filter which record to delete. It is all or nothing.

Truncate is on the other hand much faster compared to DELETE since it writes less into transaction log.




TRUNCATE dbo.Table;

First possibility is optional. When processing this command, table gets basically deleted (DROP TABLE) and created again (CREATE TABLE) without putting load on transaction log. More on truncate on Microsoft web

Rate this post
Category: Handling SQL tables Tags:

About Jan Zedníček

My name is Jan Zedníček and I work as a freelancer. I have been working as a freelancer for many companies for more than 5 years. I used to work as a financial controller, analyst and manager at many different companies in field of banking and manufacturing. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.