Transact-SQL Reference

sp_addmergepullsubscription_agent

Adds an agent for a pull subscription to a merge publication. This stored procedure is executed at the Subscriber on the subscription database.

Syntax

sp_addmergepullsubscription_agent [ [ @name = ] 'name' ]
    ,
[ @publisher = ] 'publisher'
     , [ @publisher_db = ] 'publisher_db'
     , [ @publication =] 'publication'
    [ , [ @publisher_security_mode = ] publisher_security_mode ]
    [ , [ @publisher_login = ] 'publisher_login' ]
    [ , [ @publisher_password = ] 'publisher_password' ]
    [ , [ @publisher_encrypted_password = ] publisher_encrypted_password ]
    [ , [ @subscriber = ] 'subscriber' ]
    [ , [ @subscriber_db = ] 'subscriber_db' ]
    
[ , [ @subscriber_security_mode = ] subscriber_security_mode ]
    [ , [ @subscriber_login = ] 'subscriber_login' ]
    [ , [ @subscriber_password = ] 'subscriber_password' ]
    [ , [ @distributor = ] 'distributor' ]
    
[ , [ @distributor_security_mode = ] distributor_security_mode ]
    [ , [ @distributor_login = ] 'distributor_login' ]
    
[ , [ @distributor_password = ] 'distributor_password' ]
    [ , [ @encrypted_password = ] encrypted_password ]
    [ , [ @frequency_type = ] frequency_type ]
    [ , [ @frequency_interval = ] frequency_interval ]
    [ , [ @frequency_relative_interval = ] frequency_relative_interval ]
    [ , [ @frequency_recurrence_factor = ] frequency_recurrence_factor ]
    [ , [ @frequency_subday = ] frequency_subday ]
    [ , [ @frequency_subday_interval = ] frequency_subday_interval ]
    [ , [ @active_start_time_of_day = ] active_start_time_of_day ]
    [ , [ @active_end_time_of_day = ] active_end_time_of_day ]
    [ , [ @active_start_date = ] active_start_date ]
    
[ , [ @active_end_date = ] active_end_date ]
    [ , [ @optional_command_line = ] 'optional_command_line' ]
    [ , [ @merge_jobid = ] merge_jobid ]
    [ , [ @enabled_for_syncmgr = ] 'enabled_for_syncmgr' ]
    [ , [ @ftp_address = ] 'ftp_address' ]
    [ , [ @ftp_port = ] ftp_port ]
    [ , [ @ftp_login = ] 'ftp_login' ]
    [ , [ @ftp_password = ] 'ftp_password'
    [ , [ @alt_snapshot_folder = ] 'alternate_snapshot_folder' ]
    [ , [ @working_directory = ] 'working_directory' ]
    [ , [ @use_ftp= ] 'use_ftp' ]
    [ , [ @reserved= ] 'reserved' ]
    [ , [ @use_interactive_resolver = ] 'use_interactive_resolver' ]
    [ , [ @offloadagent = ] 'remote_agent_activation' ]
    [ , [ @offloadserver = ] 'remote_agent_server_name']
    [ , [ @job_name= ] 'job_name' ]
    [ , [ @dynamic_snapshot_location= ] 'dynamic_snapshot_location' ]

Arguments

[@name = ] 'name'

Is the name of the agent. name is sysname, with a default of NULL.

[@publisher = ] 'publisher'

Is the name of the Publisher server. 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.

[@publisher_security_mode = ] publisher_security_mode

Is the security mode to use when connecting to a Publisher when synchronizing. publisher_security_mode is int, with a default of 1. If 0, specifies SQL Server Authentication. If 1, specifies Windows Authentication.

[@publisher_login = ] 'publisher_login'

Is the login to use when connecting to a Publisher when synchronizing. publisher_login is sysname, with a default of NULL.

[@publisher_password = ] 'publisher_password'

Is the password used when connecting to the Publisher. publisher_password is sysname, with a default of NULL.

[@publisher_encrypted_password = ] publisher_encrypted_password

Specifies if the password is stored in encrypted format. publisher_encrypted_password is bit, with a default of 0.

[@subscriber = ] 'subscriber'

Is the name of the Subscriber. subscriber is sysname, with a default of NULL.

[@subscriber_db = ] 'subscriber_db'

Is the name of the subscription database. subscriber_db is sysname, with a default of NULL.

[@subscriber_security_mode = ] subscriber_security_mode

Is the security mode to use when connecting to a Subscriber when synchronizing. subscriber_security_mode is int, with a default of NULL. If 0, specifies SQL Server Authentication. If 1, specifies Windows Authentication.

[@subscriber_login = ] 'subscriber_login'

Is the Subscriber login to use when connecting to a Subscriber when synchronizing. subscriber_login is required if subscriber_security_mode is set to 0. subscriber_login is sysname, with a default of NULL.

[@subscriber_password = ] 'subscriber_password'

Is the Subscriber password. subscriber_password is required if subscriber_security_mode is set to 0. subscriber_password is sysname, with a default of NULL. If a subscriber password is used, it is automatically encrypted.

[@distributor = ] 'distributor'

Is the name of the Distributor. distributor is sysname, with a default of publisher; that is, the Publisher is also the Distributor.

[@distributor_security_mode = ] distributor_security_mode

Is the security mode to use when connecting to a Distributor when synchronizing. distributor_security_mode is int, with a default of 0. 0 specifies SQL Server Authentication. 1 specifies Windows Authentication.

[@distributor_login = ] 'distributor_login'

Is the Distributor login to use when connecting to a Distributor when synchronizing. distributor_login is required if distributor_security_mode is set to 0. distributor_login is sysname, with a default of NULL.

[@distributor_password = ] 'distributor_password'

Is the Distributor password. distributor_password is required if distributor_security_mode is set to 0. distributor_password is sysname, with a default of NULL.

[@encrypted_password = ] encrypted_password

Specifies if the Distributor password is encrypted. encrypted_password is bit, with a default of 0. This is used in generating replication scripts.

[@frequency_type = ] frequency_type

Is the frequency with which to schedule the Merge Agent. frequency_type is int, and can be one of these values.

Value Description
1 One time
2 On demand
4 Daily
8 Weekly
16 Monthly
32 Monthly relative
64 Autostart
124 Recurring
NULL (default)  

[@frequency_interval = ] frequency_interval

The days that the Merge Agent runs. frequency_interval is int, and can be one of these values.

Value Description
1 Sunday
2 Monday
3 Tuesday
4 Wednesday
5 Thursday
6 Friday
7 Saturday
8 Day
9 Weekdays
10 Weekend days
NULL (default)  

[@frequency_relative_interval = ] frequency_relative_interval

Is the date of the Merge Agent. This parameter is used when frequency_type is set to 32 (monthly relative). frequency_relative_interval is int, and can be one of these values.

Value Description
1 First
2 Second
4 Third
8 Fourth
16 Last
NULL (default)  

[@frequency_recurrence_factor = ] frequency_recurrence_factor

Is the recurrence factor used by frequency_type. frequency_recurrence_factor is int, with a default of NULL.

[@frequency_subday = ] frequency_subday

Is how often to reschedule during the defined period. frequency_subday is int, and can be one of these values.

Value Description
1 Once
2 Second
4 Minute
8 Hour
NULL (default)  

[@frequency_subday_interval = ] frequency_subday_interval

Is the interval for frequency_subday. frequency_subday_interval is int, with a default of NULL.

[@active_start_time_of_day = ] active_start_time_of_day

Is the time of day when the Merge Agent is first scheduled, formatted as HHMMSS. active_start_time_of_day is int, with a default of NULL.

[@active_end_time_of_day = ] active_end_time_of_day

Is the time of day when the Merge Agent stops being scheduled, formatted as HHMMSS. active_end_time_of_day is int, with a default of NULL.

[@active_start_date = ] active_start_date

Is the date when the Merge Agent is first scheduled, formatted as YYYYMMDD. active_start_date is int, with a default of NULL.

[@active_end_date = ] active_end_date

Is the date when the Merge Agent stops being scheduled, formatted as YYYYMMDD. active_end_date is int, with a default of NULL.

[@optional_command_line = ] 'optional_command_line'

Is an optional command prompt that is supplied to the Merge Agent. For example, -DefinitionFile C:\Distdef.txt or -CommitBatchSize 10. optional_command_line is nvarchar(255), with a default of ''.

[@merge_jobid = ] merge_jobid

Is the output parameter for the job ID. merge_jobid is binary(16), with a default of NULL.

[@enabled_for_syncmgr = ] 'enabled_for_syncmgr'

Specifies if the subscription can be synchronized through Windows Synchronization Manager. enabled_for_syncmgr is nvarchar(5), with a default of FALSE. If false, the subscription is not registered with Synchronization Manager. If true, the subscription is registered with Synchronization Manager and can be synchronized without starting SQL Server Enterprise Manager.

[@ftp_address = ] 'ftp_address'

For backward compatibility only.

[@ftp_port = ] ftp_port

For backward compatibility only.

[@ftp_login = ] 'ftp_login'

For backward compatibility only.

[@ftp_password = ] 'ftp_password'

For backward compatibility only.

[@alt_snapshot_folder = ] 'alternate_snapshot_folder'

Specifies the location from which to pick up the snapshot files. alternate_snapshot_folder is nvarchar(255), with a default of NULL. If NULL, the snapshot files will be picked up from the default location specified by the Publisher.

[@working_directory = ] 'working_directory'

Is the name of the working directory used to temporarily store data and schema files for the publication when FTP is used to transfer snapshot files. working_directory is nvarchar(255), with a default of NULL. 

[@use_ftp = ] 'use_ftp'

Specifies the use of FTP instead of the typical protocol to retrieve snapshots. use_ftp is nvarchar(5), with a default of FALSE.

[@reserved = ] 'reserved'

For internal use only.

[@use_interactive_resolver = ] 'use_interactive_resolver' ]

Uses interactive resolver to resolve conflicts for all articles that allow interactive resolution. use_interactive_resolver is nvarchar(5), with a default of FALSE.

[@offloadagent = ] 'remote_agent_activation'

Specifies that the agent can be activated remotely. remote_agent_activation is nvarchar(5), with a default of FALSE. false specifies the agent cannot be activated remotely. true specifies the agent will be activated remotely, and on the remote computer specified by remote_agent_server_name.

[@offloadserver = ] 'remote_agent_server_name'

Specifies the network name of server to be used for remote agent activation. remote_agent_server_name is sysname, with a default of NULL.

[@job_name = ] 'job_name' ]

For internal use only.

[@dynamic_snapshot_location = ] 'dynamic_snapshot_location' ]

The path to the folder where the snapshot files will be read from if a dynamic snapshot is to be used. dynamic_snapshot_location is nvarchar(260), with a default of NULL.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_addmergepullsubscription_agent is used in merge replication and uses functionality similar to sp_addsubsubscriber_agent.

Permissions

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

See Also

System Stored Procedures