Monday, May 23, 2011

Drop all the tables by query


If you need to perform the same actions for all tables in a database, you can create cursor or you can use the sp_MSforeachtable undocumented stored procedure to accomplish the same goal with less work.

Drop all tables from database
Query is:
EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

No comments:

Post a Comment