Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 2.34 KB

sp-dropdevice-transact-sql.md

File metadata and controls

78 lines (55 loc) · 2.34 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_dropdevice (Transact-SQL)
Drops a database device or backup device from SQL Server instance, deleting the entry from master.dbo.sysdevices.
markingmyname
maghan
randolphwest
11/28/2023
sql
system-objects
reference
sp_dropdevice_TSQL
sp_dropdevice
backup devices [SQL Server], deleting
sp_dropdevice
TSQL

sp_dropdevice (Transact-SQL)

[!INCLUDE SQL Server]

Drops a database device or backup device from a [!INCLUDE ssdenoversion-md] instance, deleting the entry from master.dbo.sysdevices.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_dropdevice
    [ @logicalname = ] N'logicalname'
    [ , [ @delfile = ] 'delfile' ]
[ ; ]

Arguments

[ @logicalname = ] N'logicalname'

The logical name of the database device or backup device as listed in master.dbo.sysdevices.name. @logicalname is sysname, with no default.

[ @delfile = ] 'delfile'

Specifies whether the physical backup device file should be deleted. @delfile is varchar(7), with a default of NULL. If specified as DELFILE, the physical backup device disk file is deleted.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

sp_dropdevice can't be used inside a transaction.

Permissions

Requires membership in the diskadmin fixed server role.

Examples

The following example drops the tapedump1 tape dump device from the [!INCLUDE ssDE].

EXEC sp_dropdevice 'tapedump1';

Related content