sp_dbremove (Transact-SQL)
Applies to:
SQL Server
Removes a database and all files associated with that database.
Important
This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. We recommend that you use DROP DATABASE instead.
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)
Tilbakemeldinger
https://aka.ms/ContentUserFeedback.
Kommer snart: Gjennom 2024 faser vi ut GitHub Issues som tilbakemeldingsmekanisme for innhold, og erstatter det med et nytt system for tilbakemeldinger. Hvis du vil ha mer informasjon, kan du se:Send inn og vis tilbakemelding for