[MSSQL] Truncate all Table

Truncating all tables is not easy by default on MSSQL so I have search the net and found one. Just open up a new query and use the following codes:

Use databaseName
GO

EXEC sp_MSForEachTable ‘TRUNCATE TABLE ?’
GO

It will truncate all the tables under the databaseName DB.

God Bless!

Thanks,
Thomie

Author: Thomie Jose San Agustin

He is a Microsoft Certified Professional whom develop different website using ASP .NET MVC and PHP. He can also create systems out of C#. A Magna Cum Laude of Adamson University whom started a Freelance company named i-CT Combinatorics Technology with his friend Calbin Montalban. He accepts both Website and System development and even can help now his colleagues in generating their logic and research.

Leave a Reply

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