Reputation: 25701
I have a database with 1000s of tables. I want to drop all of them except say 15 of them.
Is there a quick way to do this?
Upvotes: 0
Views: 38
Reputation: 2366
You can run the below sql statement and get the list of tables you want then copy and paste the results to actually drop the tables.
SELECT 'drop table ' + t.TABLE_SCHEMA + '.' + T.TABLE_NAME + ';'
FROM INFORMATION_SCHEMA.tables t
WHERE table_name LIKE '%bob%'
Upvotes: 1