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 to a merge publication and its associated Merge Agent. This stored procedure is executed at the Publisher on the publication database.
sp_dropmergesubscription [ [ @publication= ] 'publication' ] [ , [ @subscriber= ] 'subscriber' [ , [ @subscriber_db= ] 'subscriber_db' ] [ , [ @subscription_type= ] 'subscription_type' ] [ , [ @ignore_distributor = ] ignore_distributor ] [ , [ @reserved = ] reserved ]
-- 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 batch is executed at the Publisher to remove -- a pull or push subscription to a merge publication. DECLARE @publication AS sysname; DECLARE @subscriber AS sysname; DECLARE @subscriptionDB AS sysname; SET @publication = N'AdvWorksSalesOrdersMerge'; SET @subscriber = $(SubServer); SET @subscriptionDB = N'AdventureWorks2012Replica'; USE [AdventureWorks2012] EXEC sp_dropmergesubscription @publication = @publication, @subscriber = @subscriber, @subscriber_db = @subscriptionDB; GO