Deleting a Database

Creating and Maintaining Databases

Creating and Maintaining Databases

Deleting a Database

You can delete a nonsystem database when it is no longer needed or if it is moved to another database or server. When a database is deleted, the files and their data are deleted from the disk on the server. When a database is deleted, it is permanently deleted and cannot be retrieved without using a previous backup. System databases (msdb, master, model, tempdb) cannot be deleted.

It is recommended that you back up the master database after a database is deleted, because deleting a database updates the system tables in master. If master needs to be restored, any database that has been deleted since the last backup of master will still have references in the system tables and may cause error messages to be raised.

To delete a database

Transact-SQL