DROP Azure SQL Database using T-SQL in SSMS

Viewed 1041

I am unable to DROP Azure SQL Database in SSMS

   DROP DATABASE xxxx

and getting this exception

Msg 42019, Level 16, State 4, Line 2
DROP DATABASE operation failed. Internal service error.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.
1 Answers

If you are connected to xxxx database you cannot perform drop database from within. You need to connect to master db and then perform DROP DATABASE xxxx.

DROP DATABASE

Azure SQL Database

You must be connected to the master database to drop a database.

The DROP DATABASE statement must be the only statement in a SQL batch and you can drop only one database at a time.


Second you should check if there is DELETE LOCK that prevents from dropping database.

Lock resources to prevent unexpected changes

Related