Drop multiple tables from single drop statement

Today morning when I have started work, I have to work on SQL Server. While working I come across dropping of some of tables from test database. So I started working on drop statement using query editor. Since I have to drop five tables I thought let’s try dropping all of them from one single statement. Without knowing whether it will succeed or not, I tried and got successful. Then I searched on internet and I found some of tech articles already given this dropping method in their articles.
Then I come across idea that I should share these things in my blogs and add one more section as ‘SQL Server Tips’.
So I started writing in my blog and continue to do so whenever I will get any tips and tricks for SQL Server.
First tip:
You can drop multiple tables from a database using single drop statement.
Example: suppose if you have tables like table1,table2,table3,table4,table5 and you have to drop all of them Use
DROP table1, table2, table3, table4, table5
It will drop all tables from database.
Drop multiple tables from single drop statement Drop multiple tables from single drop statement Reviewed by kamal kumar das on February 21, 2012 Rating: 5

No comments:

ads 728x90 B
Powered by Blogger.