Tuesday, August 25, 2009

SQL Server Empty All Tables

The other day I had to empty a database from all its data.
I found this link which did my job. It has a little stored procedure that I created in my database and just executed it.
I slightly modified the stored procedure to exclude some reference tables.

What I recommend after emptying the database is to compact it.
In SQL Server Management Studio one can select the database, right click choose
Tasks -> Shrink -> Database

That's all!

No comments:

Post a Comment