Drops a merge publication and its associated Snapshot Agent. All subscriptions must be dropped before dropping a merge publication. The articles in the publication are dropped automatically. This stored procedure is executed at the Publisher on the publication database.
sp_dropmergepublication is used in merge replication.
sp_dropmergepublication recursively drops all articles that are associated with a publication and then drops the publication itself. A publication cannot be removed if it has one or more subscriptions to it. For information about how to remove subscriptions, see How to: Delete a Push Subscription (Replication Transact-SQL Programming) and How to: Delete a Pull Subscription (Replication Transact-SQL Programming).
Executing sp_dropmergepublication to drop a publication does not remove published objects from the publication database or the corresponding objects from the subscription database. Use DROP <object> to remove these objects manually if necessary.
DECLARE @publication AS sysname DECLARE @publicationDB AS sysname SET @publication = N'AdvWorksSalesOrdersMerge' SET @publicationDB = N'AdventureWorks2008R2' -- Remove the merge publication. USE [AdventureWorks2008R2] EXEC sp_dropmergepublication @publication = @publication; -- Remove replication objects from the database. USE master EXEC sp_replicationdboption @dbname = @publicationDB, @optname = N'merge publish', @value = N'false' GO