| title | sp_dropdevice (Transact-SQL) | ||
|---|---|---|---|
| description | Drops a database device or backup device from SQL Server instance, deleting the entry from master.dbo.sysdevices. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!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
sp_dropdevice
[ @logicalname = ] N'logicalname'
[ , [ @delfile = ] 'delfile' ]
[ ; ]
The logical name of the database device or backup device as listed in master.dbo.sysdevices.name. @logicalname is sysname, with no default.
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.
0 (success) or 1 (failure).
None.
sp_dropdevice can't be used inside a transaction.
Requires membership in the diskadmin fixed server role.
The following example drops the tapedump1 tape dump device from the [!INCLUDE ssDE].
EXECUTE sp_dropdevice 'tapedump1';