Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

drop multiple tables with one command

Posted on 2011-09-02
6
Medium Priority
?
320 Views
Last Modified: 2012-05-12
maybe
drop table1,table2,table3

I want to drop 50 tables

is there a right click shortcut
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 14

Accepted Solution

by:
Muhammad Ahmad Imran earned 400 total points
ID: 36474217
select 'drop table [' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']'

from INFORMATION_SCHEMA.TABLES

where TABLE_NAME like 'YOUR_CRITERIA%'

 

run the output from that query to drop the tables.
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 400 total points
ID: 36474264
I confirm that you cannot have 1 drop statement to drop several tables at once.
the script above could help to generate all the drop statements...
0
 
LVL 60

Assisted Solution

by:HainKurt
HainKurt earned 400 total points
ID: 36474350
is it difficult to write 50 lines, copy paste, maybe excel can help
first column : drop table
second column : your table name
third column: ;

then copy down 1 & 3 column to row 50
fill 50 table name (or copy paste from some other place)
select all copy ansdd paste into a notepad...
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 400 total points
ID: 36474691
with that many i'd recommend doing it in a script and double/treble checking...
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 400 total points
ID: 36478158
You should be able to do:
DROP TABLE table1, table2, table3

>>is there a right click shortcut<<
From Object Explorer Details in SSMS you can select them all and then delete them all at once.
0
 

Author Closing Comment

by:rgb192
ID: 36478196
thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question