sp_addpullsubscription_agent (T-SQL)
Adds a new agent to the Subscriber’s database.
Syntax
sp_addpullsubscription_agent [@publisher =] 'publisher',
[@publisher_db =] 'publisher_db', [@publication =] 'publication'
[,[@subscriber =] 'subscriber']
[,[@subscriber_db =] 'subscriber_db']
[,[@subscriber_security_mode =] subscriber_security_mode]
[,[@subscriber_login =] 'subscriber_login']
[,[@subscriber_password =] 'subscriber_password']
[,[@distributor =] 'distributor', [,[@distribution_db =] 'distribution_db']
[,[@distributor_security_mode =] distributor_security_mode]
[,[@distributor_login =] 'distributor_login']
[,[@distributor_password =] 'distributor_password']
[,[@optional_command_line =] 'optional_command_line']
[,[@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]
[,[@distribution_jobid =] distribution_jobid OUTPUT]
[,[@encrypted_distributor_password =] encrypted_distributor_password]
[,[@enabled_for_syncmgr =] 'enabled_for_syncmgr']
[,[@ftp_address =] 'ftp_address']
[,[@ftp_port =] ftp_port]
[,[@ftp_login =] 'ftp_login']
[,[@ftp_password =] 'ftp_password']
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.
- [@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
- subscriber_security_mode is int, with a default of NULL. 0 specifies Microsoft SQL Server Authentication. 1 specifies Microsoft SQL Server Authentication.
- [@subscriber_login =] 'subscriber_login'
- subscriber_login is sysname, with a default of NULL.
- [@subscriber_password =] 'subscriber_password'
- subscriber_password is sysname, with a default of NULL.
- [@distributor =] 'distributor'
- Is the name of the Distributor. distributor is sysname, with a default of the value specified by publisher.
- [@distribution_db =] 'distribution_db'
- Is the name of the Distributor. distribution_db is sysname, with no default.
- [@distributor_security_mode =] distributor_security_mode
- Is the security mode implemented. distributor_security_mode is int, with a default of 0. 0 specifies Microsoft SQL Server Authentication. 1 specifies Microsoft SQL Server Authentication.
- [@distributor_login =] 'distributor_login'
- Is the Distributor login. distributor_login is required if distributor_security_mode is set to 0. distributor_login is sysname, with a default of sa.
- [@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.
- [@optional_command_line =] 'optional_command_line'
- Is an optional command prompt supplied to the Distribution Agent. For example, -DefinitionFile C:\Distdef.txt or -CommitBatchSize 10. optional_command_line is nvarchar(4000), with a default of NULL.
- [@frequency_type =] frequency_type
- Is the frequency with which to schedule the Distribution Agent. frequency_type is int, and can be one of these values.
Value |
Description |
1 |
One time |
2 (default) |
On demand |
4 |
Daily |
8 |
Weekly |
16 |
Monthly |
32 |
Monthly relative |
64 |
Autostart |
124 |
Recurring |
- [@frequency_interval =] frequency_interval
- Is the value to apply to the frequency set by frequency_type. frequency_interval is int, with a default of 1.
- [@frequency_relative_interval =] frequency_relative_interval
- Is the date of the Distribution 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 (default) |
First |
2 |
Second |
4 |
Third |
8 |
Fourth |
16 |
Last |
- [@frequency_recurrence_factor =] frequency_recurrence_factor
- Is the recurrence factor used by frequency_type. frequency_recurrence_factor is int, with a default of 1.
- [@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 (default) |
Once |
2 |
Second |
4 |
Minute |
8 |
Hour |
- [@frequency_subday_interval =] frequency_subday_interval
- Is the interval for frequency_subday. frequency_subday_interval is int, with a default of 1.
- [@active_start_time_of_day =] active_start_time_of_day
- Is the time of day when the Distribution Agent is first scheduled, formatted as HHMMSS. active_start_time_of_day is int, with a default of 0.
- [@active_end_time_of_day =] active_end_time_of_day
- Is the time of day when the Distribution Agent stops being scheduled, formatted as HHMMSS. active_end_time_of_day is int, with a default of 0.
- [@active_start_date =] active_start_date
- Is the date when the Distribution Agent is first scheduled, formatted as YYYYMMDD. active_start_date is int, with a default of 0.
- [@active_end_date =] active_end_date
- Is the date when the Distribution Agent stops being scheduled, formatted as YYYYMMDD. active_end_date is int, with a default of 0.
- [@distribution_jobid =] distribution_jobid OUTPUT
- Is the ID of the Distribution Agent for this job. distribution_jobid is binary(16), with a default of NULL, and it is an OUTPUT parameter.
- [@encrypted_distributor_password =] encrypted_distributor_password
- For internal use only.
- [@enabled_for_syncmgr =] 'enabled_for_syncmgr'
- Is whether the subscription can be synchronized through the Microsoft 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 launching SQL Server Enterprise Manager.
- [@ftp_address =] 'ftp_address'
- Is the network address of the FTP service for the Distributor. ftp_address is sysname, with a default of NULL.
- [@ftp_port =] ftp_port
- Is the port number of the FTP service for the Distributor. ftp_port is int, with a default of NULL.
- [@ftp_login =] 'ftp_login'
- Is the username used to connect to the FTP service. ftp_login is sysname, with a default of NULL.
- [@ftp_password =] 'ftp_password'
- Is the user password used to connect to the FTP service. ftp_password is sysname, with a default of NULL.
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_addpullsubscription_agent is used in snapshot, transactional, and merge replication.
Permissions
Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_addpullsubscription_agent.
See Also
(c) 1988-98 Microsoft Corporation. All Rights Reserved.