Transact-SQL Reference

sp_addpullsubscription

Adds a pull or anonymous subscription to a snapshot or transactional publication. This stored procedure is executed at the Subscriber on the database where the pull subscription is to be created.

Syntax

sp_addpullsubscription [ @publisher = ] 'publisher'
    ,
[ @publisher_db = ] 'publisher_db'
    , [ @publication = ] 'publication'
    [ , [ @independent_agent = ] 'independent_agent' ]
    [ , [ @subscription_type = ] 'subscription_type' ]
    
[ , [ @description = ] 'description' ]
    [ , [ @update_mode = ] 'update_mode' ]
    [ , [ @immediate_sync = ] immediate_sync ]

Arguments

[@publisher = ] 'publisher'

Is the name of the Publisher. publisher is sysname, with no default.

[@publisher_db = ] 'publisher_db'

Is the name of the Publisher database. publisher_db is sysname, with no default.

[@publication =] 'publication'

Is the name of the publication. publication is sysname, with no default.

[@independent_agent = ] 'independent_agent'

Specifies if there is a stand-alone Distribution Agent for this publication. independent_agent is nvarchar(5), with a default of TRUE. If true, there is a stand-alone Distribution Agent for this publication. If false, there is one Distribution Agent for each Publisher database/Subscriber database pair. independent_agent is a property of the publication and must have the same value here as it has at the Publisher.

[@subscription_type = ] 'subscription_type'

Is the subscription type of the publication. subscription_type is nvarchar(9), and can be one of these values.

Value Description
pull Pull subscription
anonymous (default) Anonymous subscription

[@description = ] 'description'

Is the description of the publication. description is nvarchar(100), with a default of NULL.

[@update_mode = ] 'update_mode'

Is the type of update. update_mode is nvarchar(15), and can be one of these values.

Value Description
read-only (default) The subscription is read-only. The changes at the Subscriber will not be sent back to the Publisher.
synctran Enables support for immediate updating subscriptions.
queued tran Enables the subscription for queued updating. Data modifications can be made at the Subscriber, stored in a queue, and then propagated to the Publisher.
failover Enables the subscription for immediate updating with queued updating as a failover. Data modifications can be made at the Subscriber and propagated to the Publisher immediately. If the Publisher and Subscriber are not connected, data modifications made at the Subscriber can be stored in a queue until the Subscriber and Publisher are reconnected.

[@immediate_sync = ] immediate_sync

Is whether the synchronization files are created or re-created each time the Snapshot Agent runs. immediate_sync is bit with a default of 1, and must be set to the same value as immediate_sync in sp_addpublication. immediate_sync is a property of the publication and must have the same value here as it has at the Publisher.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_addpullsubscription is used in snapshot replication and transactional replication.

If the MSreplication_subscriptions table does not exist at the Subscriber, sp_addpullsubscription creates it. It also adds a row to the MSreplication_subscriptions table. For pull subscriptions, sp_addsubscription should be called at the Publisher first.

Permissions

Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_addpullsubscription.

See Also

sp_droppullsubscription

sp_helppullsubscription

System Stored Procedures