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 publication and its associated Snapshot Agent. All subscriptions must be dropped before dropping a publication. The articles in the publication are dropped automatically. This stored procedure is executed at the Publisher on the publication database.
sp_droppublication is used in snapshot replication and transactional replication.
sp_droppublication recursively drops all articles 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 Delete a Push Subscription and Delete a Pull Subscription.
Executing sp_droppublication 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 @publicationDB AS sysname; DECLARE @publication AS sysname; SET @publicationDB = N'AdventureWorks'; SET @publication = N'AdvWorksProductTran'; -- Remove a transactional publication. USE [AdventureWorks2012] EXEC sp_droppublication @publication = @publication; -- Remove replication objects from the database. USE [master] EXEC sp_replicationdboption @dbname = @publicationDB, @optname = N'publish', @value = N'false'; GO