Wednesday, June 18, 2014

To drop all tables

SQL server is providing a nice option to drop all the tables at a stretch. Below is the query to achieve the same
EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

To drop single table:
EXEC sp_MSforeachtable @command1 = "DROP TABLE <TableName>"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.