Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 2.53 KB

sp-delete-database-backuphistory-transact-sql.md

File metadata and controls

81 lines (58 loc) · 2.53 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_delete_database_backuphistory (Transact-SQL)
Deletes information about the specified database from the backup and restore history tables.
markingmyname
maghan
randolphwest
01/23/2024
sql
system-objects
reference
sp_delete_database_backuphistory
sp_delete_database_backuphistory_TSQL
sp_delete_database_backuphistory
TSQL

sp_delete_database_backuphistory (Transact-SQL)

[!INCLUDE SQL Server]

Deletes information about the specified database from the backup and restore history tables.

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

Syntax

sp_delete_database_backuphistory [ @database_name = ] N'database_name'
[ ; ]

Arguments

[ @database_name = ] N'database_name'

Specifies the name of the database involved in backup and restore operations. @database_name is sysname, with no default.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

sp_delete_database_backuphistory must be run from the msdb database.

This stored procedure affects the following tables:

Permissions

[!INCLUDE msdb-execute-permissions]

Examples

The following example deletes all entries for the [!INCLUDE ssSampleDBobject] database in the backup-and-restore history tables.

USE msdb;
GO
EXEC sp_delete_database_backuphistory
    @database_name = 'AdventureWorks2022';

Related content