2

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.
2
  • Do you get the error if you run only the DROP DATABASE xxxx; statement (without IF EXISTS)? Commented Jun 28, 2019 at 10:57
  • @DanGuzman I have edited my question and simplified the script with just drop command and error still occurs Commented Jun 28, 2019 at 13:51

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. if sql script is executed by windows app or any other tool then within script do i need something like 'USE master go then drop statement afterwards because within ssms i cannot apply 'use master statement however i can switch from ui drop down

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.