Empty a table with truncate table in SQL Server

How to completely empty a SQL Server table? The TRUNCATE TABLE command empties all the data in the table.

How to completely delete data in a SQL Server table with TRUNCATE TABLE?

The truncate table statement is the fastest to delete all data from a given table. Indeed, it is different from the DELETE statement that reads all the lines to select the one to be deleted. The TRUNCATE deletes all with no line by lines checks on primary keys.

Remember to check your database backups before running the TRUNCATE to avoid losing data.

This command deletes all the data stored in the table. Be careful, this command is irreversible.


To delete the table, i.e. the data structure. Use the drop statement. And to avoir errors, first check the existence of the table, but also the dependencies to other tables with foreign keys.