drop multiple tables ms sql 2005

robrodp used Ask the Experts™
I have a ms sql 2005 database with too many tables, I have backed up the database, now I need to delete many tables, but doing it one by one iis very time consuming(bothin the manager and as a query). Is there a way to use wildcards or graphically select multiple filed and dropping them?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Developer
If you have the list of tables on the left hand side and have the "Tables" entry selected (rather than a specific table) in SQL Studio (can't remember the exact name, sorry), take a look at the menus and make sure you have the View Details option enabled.The right hand side should now show you all the tables (like explorer shows all the files/folders).

You should be able to do the use standard multiple select facility of windows (Hold CTRL and left click tables to be deleted).Once you've selected all the tables, press the delete key on your keyboard.That should do it.If you have any dependencies, then the higher order tables may not go first time, so you will probably need to repeat this several times.
Reza RadConsultant, Trainer

you can use this syntax:
drop table table1,table2,table3 , ...



When you know.. you know thx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial