Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Applies to:
SQL Server
Azure SQL Managed Instance
Adds a schedule for the Distribution Agent and Merge Agent. This stored procedure is executed at the Publisher on any database.
Transact-SQL syntax conventions
sp_addsubscriber_schedule
[ @subscriber = ] N'subscriber'
[ , [ @agent_type = ] agent_type ]
[ , [ @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 ]
[ , [ @publisher = ] N'publisher' ]
[ ; ]
The name of the Subscriber. @subscriber is sysname, with no default. @subscriber must be unique in the database, must not already exist, and can't be NULL
.
The type of agent. @agent_type is smallint, and can be one of these values.
Value | Description |
---|---|
0 (default) |
Distribution Agent |
1 |
Merge Agent |
Specifies 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 |
On demand |
4 |
Daily |
8 |
Weekly |
16 |
Monthly |
32 |
Monthly relative |
64 (default) |
Autostart |
128 |
Recurring |
The value to apply to the frequency set by frequency_type. @frequency_interval is int, with a default of 1
.
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 |
The recurrence factor used by frequency_type. @frequency_recurrence_factor is int, with a default of 0
.
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 (default) |
Minute |
8 |
Hour |
The interval for frequency_subday. @frequency_subday_interval is int, with a default of 5
.
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
.
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 235959
, which means 11:59:59 P.M. as measured on a 24-hour clock.
The date when the Distribution Agent is first scheduled, formatted as yyyyMMdd
. @active_start_date is int, with a default of 0
.
The date when the Distribution Agent stops being scheduled, formatted as yyyyMMdd
. @active_end_date is int, with a default of 99991231
, which means December 31, 9999.
Specifies a non-SQL Server Publisher. @publisher is sysname, with a default of NULL
.
@publisher shouldn't be specified for a SQL Server Publisher.
0
(success) or 1
(failure).
sp_addsubscriber_schedule
is used in snapshot replication, transactional replication, and merge replication.
Only members of the sysadmin fixed server role can execute sp_addsubscriber_schedule
.