Delete all tables from db in ms sql

For purpose of deleting all tables in MS SQL fitting is:

EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

This is a hidden stored procedure in sql server that will be executed for each table in the database you chosen.

Also here described how to imitate drop in db 

1 Comment

  • docotor said

    In case if you execute mentioned SQL and see error messages, then helpful for you will be idea to execute it few times until error message will not disappear.

Add a Comment