Announcing our $3.4M seed round 🚀 Read more →

How to Truncate a Table in SQL Server in SQL Server

Be very careful with TRUNCATE command. It will empty the content of your SQL Server table. This is useful in development, but you'll rarely want to do this in production.

--syntax
truncate table table_name;

truncate table users;

If the table contains an AUTO_INCREMENT column, the counter for it will also get reset. Note that this behavior is different vs some other databases like PostgreSQL for example, where you need to reset the counter yourself.

Ready for a modern SQL editor?