Skip to content

Latest commit

 

History

History
75 lines (58 loc) · 2.52 KB

File metadata and controls

75 lines (58 loc) · 2.52 KB
title sp_dbremove (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql-non-specified
ms.reviewer
ms.suite
ms.technology
database-engine
ms.tgt_pltfrm
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
caps.latest.revision 32
author BYHAM
ms.author rickbyh
manager jhubbard

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.

Applies to: [!INCLUDEssNoVersion] ([!INCLUDEssKatmai] through current version).

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)