• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

drop multiple tables with one command

maybe
drop table1,table2,table3

I want to drop 50 tables

is there a right click shortcut
0
rgb192
Asked:
rgb192
5 Solutions
 
Muhammad Ahmad ImranDatabase DeveloperCommented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
HainKurtSr. System AnalystCommented:
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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
LowfatspreadCommented:
with that many i'd recommend doing it in a script and double/treble checking...
0
 
Anthony PerkinsCommented:
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
 
rgb192Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now