How to Truncate a Table 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.

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.

database icon
Better SQL for the people
Get more done with PopSQL and SQL Server