My initial concern was to DROP DATABASE MyDB
when a certain condition is met but I get this error:
Database 'MyDB' is still in use
So, the answer I found was to do
USE master
DROP DATABASE MyDB
It works, but for my case there is no guarantee whether master
will be the default database on the server or not.
I would like to know how do I get the default database name for that particular server so that I can write something like
USE Default_DB
DROP DATABASE MyDB