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 Syntax

TRUNCATE TABLE dbo.Table;

or

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
Tags:

Jan Zedníček - Data & Finance

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 10 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 and to put them forward to anyone.

Leave a Reply

Your email address will not be published. Required fields are marked *