分享方式:


sp_changesubscriber_schedule (Transact-SQL)

適用於:SQL Server Azure SQL 受控執行個體

變更訂閱者的 散發代理程式 或 合併代理程式 排程。 此預存程式會在任何資料庫的發行者端執行。

Transact-SQL 語法慣例

語法

sp_changesubscriber_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' ]
[ ; ]

引數

[ @subscriber = ] N'subscriber'

訂閱者的名稱。 @subscriber為 sysname,沒有預設值。 訂閱者的名稱在資料庫中必須是唯一的,不能已經存在,而且不能是 NULL

[ @agent_type = ] agent_type

代理程式的類型。 @agent_type為 smallint,預設值為 0

  • 0表示 散發代理程式。
  • 1表示 合併代理程式。

[ @frequency_type = ] frequency_type

指定要排程散發工作的頻率。 @frequency_type為 int,而且可以是下列其中一個值。

Description
1 一次性
2 [視需要]
4 每日
8 每週
16 每月
32 每月相對
64 (預設值) 自動啟動
128 重複執行

[ @frequency_interval = ] frequency_interval

套用至@frequency_type設定頻率的值。 @frequency_interval 為 int,取決於@frequency_type的值

@frequency_type的值 @frequency_interval的影響
1 (預設值) @frequency_interval未使用。
4 @frequency_interval 天。
8 @frequency_interval是下列其中一或多個專案(結合 |(位元 OR)(Transact-SQL)邏輯運算子):

1 = 星期日
2 = 星期一
4 = 星期二
8 = 星期三
16 = 星期四
32 = 星期五
64 = 星期六
16 當月@frequency_interval 日。
32 @frequency_interval是下列其中一個選項:

1 = 星期日
2 = 星期一
3 = 星期二
4 = 星期三
5 = 星期四
6 = 星期五
7 = 星期六
8 = 日
9 = Weekday
10 = 週末日
64 @frequency_interval未使用。
128 @frequency_interval未使用。

[ @frequency_relative_interval = ] frequency_relative_interval

散發工作的日期。 @frequency_relative_interval為 int,而且可以是下列其中一個值。

Description
1 (預設值) First
2 Second
4 Third
8 第四個
16 姓氏

[ @frequency_recurrence_factor = ] frequency_recurrence_factor

@frequency_type所使用的週期因數。 @frequency_recurrence_factor為 int,預設值為 0

[ @frequency_subday = ] frequency_subday

指定在定義期間重新排程的頻率,以分鐘為單位。 @frequency_subday為 int,而且可以是下列其中一個值。

Description
1 一次
2 第二個
4 (預設值) Minute
8 Hour

[ @frequency_subday_interval = ] frequency_subday_interval

每個作業執行之間發生的frequency_subday期間數@frequency_subday_interval 為 int,預設值為 5

[ @active_start_time_of_day = ] active_start_time_of_day

第一次排程散發工作的時間。 @active_start_time_of_day為 int,預設值為 NULL

[ @active_end_time_of_day = ] active_end_time_of_day

散發工作停止排程的一天時間。 @active_end_time_of_day為 int,預設值235959為 ,表示下午 24 小時製為 11:59:59。

[ @active_start_date = ] active_start_date

第一次排程散發工作的日期,格式為 yyyyMMdd@active_start_date為 int,預設值為 NULL

[ @active_end_date = ] active_end_date

散發工作停止排程的日期,格式為 yyyyMMdd@active_end_date為 int,預設值99991231為 ,表示 9999 年 12 月 31 日。

[ @publisher = ] N'publisher'

指定非 SQL Server 發行者。 @publisher為 sysname,預設值為 NULL

變更 SQL Server 發行者上的發行項屬性時,不應使用@publisher。

傳回碼值

0 (成功) 或 1 (失敗)。

備註

sp_changesubscriber_schedule 用於所有類型的複寫。

權限

只有系統管理員固定伺服器角色的成員才能執行 sp_changesubscriber_schedule