Can you drop the database currently you working on? SQL Server Interview questions

Can you drop the database currently you using/working, in same session?
Ans: No

Lets see:
Here we are going to try to drop the database with name "HH" and current we are using same "HH" database
 we can't drop the database current we using. if you fire the drop query then you will got the following error message.
Msg 3702, Level 16, State 3, Line 1
Cannot drop database "YourDBName" because it is currently in use.

Now user other database and execute same query then see what happened.

Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.