Applies To: SQL Server 2014, SQL Server 2016 Preview
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Drops a subscription at the current database of the Subscriber. This stored procedure is executed at the Subscriber on the pull subscription database.
sp_droppullsubscription is used in snapshot replication and transactional replication.
sp_droppullsubscription deletes the corresponding row in the MSreplication_subscriptions (Transact-SQL) table and the corresponding Distributor Agent at the Subscriber. If no rows are left in MSreplication_subscriptions (Transact-SQL), it drops the table.
-- This script uses sqlcmd scripting variables. They are in the form -- $(MyVariable). For information about how to use scripting variables -- on the command line and in SQL Server Management Studio, see the -- "Executing Replication Scripts" section in the topic -- "Programming Replication Using System Stored Procedures". -- This is the batch executed at the Subscriber to drop -- a pull subscription to a transactional publication. DECLARE @publication AS sysname; DECLARE @publisher AS sysname; DECLARE @publicationDB AS sysname; SET @publication = N'AdvWorksProductTran'; SET @publisher = $(PubServer); SET @publicationDB = N'AdventureWorks2012'; USE [AdventureWorks2012Replica] EXEC sp_droppullsubscription @publisher = @publisher, @publisher_db = @publicationDB, @publication = @publication; GO