Skip to content

Instantly share code, notes, and snippets.

@davidbreyer
Last active December 15, 2017 15:52
Show Gist options
  • Save davidbreyer/9548747 to your computer and use it in GitHub Desktop.
Save davidbreyer/9548747 to your computer and use it in GitHub Desktop.
T-SQL script that will drop each table in the database. Requires repeated executions.
EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"
--Or maybe just delete
EXEC sp_MSForEachTable "DELETE FROM ?"
--or truncate
EXEC sp_MSForEachTable "TRUNCATE TABLE ?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment