Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.51 KB

sp-subscription-cleanup-transact-sql.md

File metadata and controls

77 lines (53 loc) · 2.51 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_subscription_cleanup (Transact-SQL)
sp_subscription_cleanup removes metadata when a subscription is dropped at a Subscriber.
markingmyname
maghan
randolphwest
04/08/2024
sql
replication
reference
sp_subscription_cleanup_TSQL
sp_subscription_cleanup
sp_subscription_cleanup
TSQL

sp_subscription_cleanup (Transact-SQL)

[!INCLUDE SQL Server]

Removes metadata when a subscription is dropped at a Subscriber. For a synchronizing transaction subscription, it also includes immediate-updating triggers. This stored procedure is executed at the Subscriber on the subscription database.

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

Syntax

sp_subscription_cleanup
    [ @publisher = ] N'publisher'
    [ , [ @publisher_db = ] N'publisher_db' ]
    [ , [ @publication = ] N'publication' ]
    [ , [ @reserved = ] N'reserved' ]
    [ , [ @from_backup = ] from_backup ]
[ ; ]

Arguments

[ @publisher = ] N'publisher'

The name of the Publisher. @publisher is sysname, with no default.

[ @publisher_db = ] N'publisher_db'

The name of the Publisher database. @publisher_db is sysname, with a default of NULL.

[ @publication = ] N'publication'

The name of the publication. @publication is sysname, with a default of NULL. If NULL, subscriptions using a shared agent publication in the publishing database are deleted.

[ @reserved = ] N'reserved'

[!INCLUDE ssInternalOnly]

[ @from_backup = ] from_backup

[!INCLUDE ssInternalOnly]

Return code values

0 (success) or 1 (failure).

Remarks

sp_subscription_cleanup is used in transactional and snapshot replication.

Permissions

Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_subscription_cleanup.

Related content