Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 2.25 KB

File metadata and controls

67 lines (51 loc) · 2.25 KB
title sp_dbremove (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service database-engine
ms.reviewer
ms.technology system-objects
ms.topic language-reference
f1_keywords
sp_dbremove
sp_dbremove_TSQL
dev_langs
TSQL
helpviewer_keywords
sp_dbremove
ms.assetid a8513f4a-c025-49c8-99c3-4c83cb7f51ed
author stevestein
ms.author sstein

sp_dbremove (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-md]

Removes a database and all files associated with that database.

Important

[!INCLUDEssNoteDepFutureAvoid] We recommend that you use DROP DATABASE instead.

Topic link icon Transact-SQL Syntax Conventions

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

Requires membership in the sysadmin fixed server role.

Examples

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

EXEC sp_dbremove sales;  

See Also

ALTER DATABASE (Transact-SQL)
CREATE DATABASE (SQL Server Transact-SQL)
DBCC (Transact-SQL)
sp_detach_db (Transact-SQL)