Azure Data Studio – Delete Database Extension

While we don’t delete production databases very often, that is not the case with development or even on the local instance of SQL Server on our laptop. We may delete databases from these lower environments quite often. Out of the box, Azure Data Studio does not provide the ability to right click on a database and delete it.  SQL Server Management Studio has had this functionality all along.  Like most other extensions, this is still in preview.

If you look at the image below, you can easily see that there is NOT a delete option.

While we are able to use the DROP DATABASE statement, sometimes is it nice to just right click on a database and delete it. There is now an extension available named Delete Database.  There is the link to the GitHub for this extension.  Once installed you will now see the Delete option.

When you first go to the extension options in Azure Data Studio you want to look for this extension.

When you click on the extension, you will see what is below.   There really isn’t much information here, although to be fair, this is a pretty simple extension.  It does one thing, adds an option to the context menu when you right click on a database.

This extension is installed by using the “Install Extension with VISX package” option under the File menu.

Once installed you can now right click on the database and delete it.  However, something to keep in mind, you will not see the usual popup you would see in SSMS.  You will see this in the lower right hand corner of Azure Data Studio.

When you click yes, the database will be deleted and the list of databases under the “Databases” item in the connection will automatically update.  That is not the case if you use the code below.


If the DROP DATABASE statement is used, you will need to manually refresh the list of databases.  In the image below, the DROP DATABASE statement was executed and I then right clicked on Databases, and the database was still in the list.  If I right clicked on the server, in this case LocalHost and then refresh, the database list was refresh as expected.

If this is the first time visiting this page, you will see the Install button, click that button and you will be taken to the GitHub for the extension.  The VSDI can be downloaded there. Remember to place it in a location that other processes will not delete it.

After the installation is completed, you will not need to restart Azure Data Studio to utilized the Delete option on the context menu.  However, if you disable the extension, you WILL need to restart ADS.

As always, use caution when deleting databases.  Deleting the wrong database can be a major outage event.  So use caution when attempting to delete a database.

Thanks for visiting my blog!!!