Uninstalling a Database

If you will no longer be using a removable media database, it can be uninstalled using the sp_dbremove stored procedure. The removable media does not need to be in the drive for you to uninstall the database.

The sp_dbremove stored procedure removes the entries in sysdatabases and sysusages for the specified database. If the dropdev keyword is included, it also removes from sysdevices all devices of which that database has exclusive use. It does not delete the physical operating system files for the devices.

    To uninstall a database

The sp_dbremove stored procedure can be used to remove all databases, not only those on removable media.

Note After you remove a database you should back up the master database.

For more information about using sp_dbremove, see the sp_dbremove System Stored Procedure topic in the Microsoft SQL Server Transact-SQL Reference.