sp_addsubscription Replication Stored Procedure
For SQL Server 6.5 information, see sp_addsubscription in What's New for SQL Server 6.5.
Adds a subscription to an article and sets the subscriber's status.
Syntax
sp_addsubscription publication [, 'article'] , subscriber [, destination_db]
[, @sync_type = {'automatic' | 'manual' | 'none'}]
[, @status = {'inactive' | 'active' | 'subscribed'}]
where
-
publication
-
Specifies the name of the publication.
-
article
-
Specifies the article that will be subscribed to. The article name must be unique within the publication. If set to all or not supplied, a subscription is added to all articles in that publication.
-
subscriber
-
Is the name of the subscription server subscribing to this article.
-
destination_db
-
Is the name of the destination database in which to place replicated data. The default uses the same name as the publication database.
-
@sync_type
-
Is the subscription synchronization type. When set to automatic (the default), synchronization is applied to the subscription server via the distribution process. When set to manual, a synchronization file is automatically produced, but it must be manually applied to the subscription server. This parameter can also be set to none (no initial synchronization).
-
@status
-
Is the subscription status. If sync_type = none, the default for status is active; otherwise the default is subscribed. To enable a subscriber to see articles in a restricted publication article, a "placeholder" subscription must be created with inactive status.
Remarks
Only the system administrator or database owner can locally add a subscription to an existing article.
Example
This example adds the subscriber AIREDALE to the article authors in the publication authors_publication.
sp_addsubscription authors_publication, authors, AIREDALE
Permission
Execute permission defaults to the system administrator and database owner.
Tables Used
sysarticles, syspublications, syssubscriptions, sysservers
See Also