Udostępnij za pośrednictwem


sp_update_schedule (języka Transact-SQL)

Zmienia ustawienia SQL Server Harmonogram agenta.

Topic link iconKonwencje składni języka Transact-SQL

sp_update_schedule 
    {   [ @schedule_id = ] schedule_id 
      | [ @name = ] 'schedule_name' }
    [ , [ @new_name = ] new_name ]
    [ , [ @enabled = ] enabled ]
    [ , [ @freq_type = ] freq_type ]
    [ , [ @freq_interval = ] freq_interval ] 
    [ , [ @freq_subday_type = ] freq_subday_type ] 
    [ , [ @freq_subday_interval = ] freq_subday_interval ] 
    [ , [ @freq_relative_interval = ] freq_relative_interval ] 
    [ , [ @freq_recurrence_factor = ] freq_recurrence_factor ] 
    [ , [ @active_start_date = ] active_start_date ] 
    [ , [ @active_end_date = ] active_end_date ] 
    [ , [ @active_start_time = ] active_start_time ] 
    [ , [ @active_end_time = ] active_end_time ] 
    [ , [ @owner_login_name = ] 'owner_login_name' ]
    [ , [ @automatic_post =] automatic_post ]

Argumenty

  • [ @schedule_id = ] schedule_id
    The identifier of the schedule to modify.schedule_id is int, with no default.Albo schedule_id lub schedule_name musi być określona.

  • [ @name = ] 'schedule_name'
    The name of the schedule to modify.schedule_nameis sysname, with no default.Albo schedule_id lub schedule_name musi być określona.

  • [ @ nowa_nazwa= ] new_name
    The new name for the schedule.new_name is sysname, with a default of NULL.Kiedy new_name ma wartość NULL, nazwę arkusza, który nie ulega zmianie.

  • [ @enabled = ] enabled
    Wskazuje aktualny status harmonogramu.Parametr enabled jest typu tinyint, a jego wartość domyślna to 1 (włączone).Jeśli wynosi 0, harmonogram nie jest aktywny.Przy wyłączonym harmonogramie nie są wykonywane żadne zapisane w nim zadania.

  • [ @freq_type = ] freq_type
    A value indicating when a job is to be executed.freq_typeis int, with a default of 0, and can be one of these values.

    Wartość

    Description

    1

    Tylko raz

    4

    Dzienne

    8

    Co tydzień

    16

    Miesięczne

    32

    Zmiana usługa dla trasa freq interval

    64

    Uruchamianie wraz z uruchomieniem programu SQLServerAgent

    128

    Uruchomić, gdy komputer jest bezczynny

  • [ @freq_interval = ] freq_interval
    The days that a job is executed.freq_interval is int, with a default of 0, and depends on the value of freq_type.

    Zmiana adresu dla trasa freq_type

    Wpływ na parametr freq_interval

    1 (tylko raz.)

    freq_interval jest nieużywany.

    4 (codziennie)

    Co freq_interval dni.

    8 (tydzień)

    freq_interval jest co najmniej jedną z następujących czynności (w połączeniu z LUB operator logiczny):

    1 = Sunday

    2 = Monday

    4 = Tuesday

    8 = $ Środa

    16 = $ Czwartek

    32 = Friday

    64 = $ Sobota

    16 (co miesiąc)

    Na freq_interval dzień miesiąca.

    32 (co miesiąc, względnie)

    freq_interval jest jednym z następujących czynności:

    1 = Sunday

    2 = Monday

    3 = Tuesday

    4 = $ Środa

    5 = $ Czwartek

    6 = Friday

    7 = $ Sobota

    8 = Day

    9 = Weekday

    10 = dzień roboczy

    64 (po uruchomieniu usługa SQLServerAgent)

    freq_interval jest nieużywany.

    128

    freq_interval jest nieużywany.

  • [ @freq_subday_type = ] freq_subday_type
    Specifies the units for freq_subday_interval*. freq_subday_typeis int, with a default of 0, and can be one of these values.*

    Wartość

    Opis (jednostki)

    0x1

    W określonym czas

    0x2

    Seconds

    0x4

    Minutes

    0x8

    Hours

  • [ @freq_subday_interval = ] freq_subday_interval
    The number of freq_subday_type periods to occur between each execution of a job.freq_subday_intervalis int, with a default of 0.

  • [ @freq_relative_interval = ] freq_relative_interval
    A job's occurrence of freq_interval in each month, if freq_interval is 32 (monthly relative).freq_relative_intervalis int, with a default of 0, and can be one of these values.

    Wartość

    Opis (jednostki)

    1

    First

    2

    Sekundy

    4

    Trzecia

    8

    Czwarty

    16

    Last

  • [ @freq_recurrence_factor = ] freq_recurrence_factor
    The number of weeks or months between the scheduled execution of a job.freq_recurrence_factor is used only if freq_type is 8, 16, or 32.freq_recurrence_factoris int, with a default of 0.

  • [ @active_start_date = ] active_start_date
    The date on which execution of a job can begin.active_start_dateis int, with a default of NULL, which indicates today's date.Data jest w formacie RRRRMMDD.Jeśli active_start_date jest to zwraca żadnej wartości, zmienna jest podkwerendą wartość skalarna zestaw wartości null.

    Jedna instrukcja SELECT może zainicjować wielu zmiennych lokalnych.Aby uzyskać więcej informacji zobacz sekcję "Planowanie data rozpoczęcia" w Creating and Attaching Schedules to Jobs.

  • [ @active_end_date = ] active_end_date
    Dzień, w którym wykonywanie zadania może się zakończyć.Parametr active_end_datejest typu int i domyślnie ma wartość 99991231, co oznacza 31 grudnia 9999 r.Używa formatu RRRRMMDD.

  • [ @active_start_time = ] active_start_time
    The time on any day between active_start_date and active_end_date to begin execution of a job.active_start_timeis int, with a default of 000000, which indicates 12:00:00 A.M.on a 24-hour clock, and must be entered using the form HHMMSS.

  • [ @active_end_time = ] active_end_time
    The time on any day between active_start_date and active_end_date to end execution of a job.active_end_timeis int, with a default of 235959, which indicates 11:59:59 P.M.on a 24-hour clock, and must be entered using the form HHMMSS.

  • [ @ owner_login_name= ] "owner_login_name'
    The name of the server principal that owns the schedule.owner_login_name is sysname, with a default of NULL, which indicates that the schedule is owned by the creator.

  • [ @automatic_post =] automatic_post
    Zarezerwowane.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Remarks

sp_help_spatial_geometry_indexCertProperty (języka Transact-SQL)

Uprawnienia

Domyślnie członkowie sysadmin stała rola serwera możliwość wykonać tej procedura przechowywana.Inni użytkownicy klastrowa musi mieć jedną z następujących czynności SQL Server Agent stałe role bazy danych w msdb bazy danych:

  • SQLAgentUserRole

  • SQLAgentReaderRole

  • SQLAgentOperatorRole

Aby uzyskać szczegółowe informacje o uprawnieniach z tych ról zobacz SQL Server Agent Fixed Database Roles.

Tylko członkowie sysadmin można zmodyfikować harmonogram posiadanych przez innego użytkownika.

Przykłady

Poniższy przykład powoduje zmianę stanu włączonego NightlyJobs Planowanie do 0 i ustawia dla właściciela terrid.

USE msdb ;
GO

EXEC dbo.sp_update_schedule
    @name = 'NightlyJobs',
    @enabled = 0,
    @owner_login_name = 'terrid' ;
GO

Historia zmian

Microsoft Learning

W poniższej tabela zestawiono formaty wprowadzania wyrażenie, które nie są prawidłowe i że powrócić, 0 lub błąd.