Removes a database and all files associated with that database.
|Applies to: SQL Server (SQL Server 2008 through current version).|
sp_dbremove [ @dbname = ] 'database' [ , [ @dropdev = ] 'dropdev' ]
[ @dbname= ] 'database'
Is the name of the database to be removed. database is sysname, with a default value of NULL.
[ @dropdev= ] 'dropdev'
Is a flag provided for backward compatibility only and is currently ignored. dropdev has the value dropdev.
0 (success) or 1 (failure)
Requires membership in the sysadmin fixed server role.
The following example removes a database named
sales and all files associated with it.
EXEC sp_dbremove sales;