Skip to content

Latest commit

 

History

History
85 lines (58 loc) · 3.24 KB

File metadata and controls

85 lines (58 loc) · 3.24 KB
title sp_droppullsubscription (Transact-SQL)
description sp_droppullsubscription drops a subscription at the current database of the Subscriber.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 06/23/2025
ms.service sql
ms.subservice replication
ms.topic reference
f1_keywords
sp_droppullsubscription
sp_droppullsubscription_TSQL
helpviewer_keywords
sp_droppullsubscription
dev_langs
TSQL

sp_droppullsubscription (Transact-SQL)

[!INCLUDE SQL Server SQL MI]

Drops a subscription at the current database of the Subscriber. This stored procedure is executed at the Subscriber on the pull subscription database.

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

Syntax

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

Arguments

[ @publisher = ] N'publisher'

The remote server name. @publisher is sysname, with no default. If all, the subscription is dropped at all the Publishers.

[ @publisher_db = ] N'publisher_db'

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

[ @publication = ] N'publication'

The publication name. @publication is sysname, with no default. If all, the subscription is dropped to all the publications.

[ @reserved = ] reserved

[!INCLUDE ssinternalonly-md]

[ @from_backup = ] from_backup

[!INCLUDE ssinternalonly-md]

Return code values

0 (success) or 1 (failure).

Remarks

sp_droppullsubscription is used in snapshot replication and transactional replication.

sp_droppullsubscription deletes the corresponding row in the MSreplication_subscriptions table and the corresponding Distributor Agent at the Subscriber. If no rows are left in MSreplication_subscriptions, it drops the table.

Examples

:::code language="sql" source="../replication/codesnippet/tsql/sp-droppullsubscription-_1.sql":::

Permissions

Only members of the sysadmin fixed server role or the user who created the pull subscription can execute sp_droppullsubscription. The db_owner fixed database role is only able to execute sp_droppullsubscription if the user who created the pull subscription belongs to this role.

Related content