How to Remove Multiple Databases Marked with "Recovery Pending" Recently I tried to clean my appilcations which used SQL database(s), therefore, the leftover databases are now marked with "Recovery Pending".



Right now I can follow this to delete them manually.

How do I remove all those DBs marked with "Recovery Pending" in only one action?
You need to get the meta-data off your SQL Server (as seen in sys.databases) and that is indeed the DROP database command (which is performed by SSMS when you right-click and Delete). Either do them one-by-one, as in

DROP DATABASE a DROP DATABASE b


Or more then one at once, as in

DROP DATABASE a, b


You can also generate those DROP commands, such as:

SELECT 'DROP DATABASE ' + QUOTENAME(name)
FROM sys.databases
WHERE state_desc = 'RECOVERY_PENDING'