sp_unsubscribe Replication Stored Procedure

Remotely cancels a subscription to a particular article within a publication, to a whole publication, or to all publications. It also removes all pending jobs from the distribution database.

Syntax

sp_unsubscribe 'publication', 'article'

where

publication
Is the name of the associated publication. Specifying all drops all subscriptions. An entry is required.
article
Is the name of the article. Specifying all drops subscriptions to all articles for each specified publication.

Remarks

If the publication is restricted, running sp_unsubscribe causes the status for this subscription to be changed to inactive.

Example

This example cancels a subscription to all articles and all publications.

sp_unsubscribe 'all', 'all'

Permission

Execute permission defaults to the system administrator and the database owner and is also granted to repl_subscriber.

Tables Used

sysarticles, syspublications, syssubscriptions, sysservers

See Also

sp_addsubscription sp_dropsubscription
sp_changesubscription sp_helpsubscription
sp_changesubstatus sp_subscribe