sp_dbremove (T-SQL)

Removes a database and all files associated with that database.


Important This procedure is provided for backward compatibility only. For removable media databases, use sp_detach_db to remove a database from the server.


Syntax

sp_dbremove [@dbname =] 'database' [, [@dropdev =] 'dropdev']

Arguments
[@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.
Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Permissions

Execute permissions default to members of the sysadmin fixed server role or db_owner fixed database role for the database for which the drop will be performed.

Example

This example removes a database named sales and all files associated with it.

sp_dbremove sales

  

See Also
ALTER DATABASE sp_detach_db
CREATE DATABASE System Stored Procedures
DBCC  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.