Share via


sp_help_schedule(Transact-SQL)

적용 대상:SQL Server

일정에 대한 정보를 나열합니다.

Transact-SQL 구문 표기 규칙

구문

sp_help_schedule
    [ [ @schedule_id = ] schedule_id ]
    [ , [ @schedule_name = ] N'schedule_name' ]
    [ , [ @attached_schedules_only = ] attached_schedules_only ]
    [ , [ @include_description = ] include_description ]
[ ; ]

인수

[ @schedule_id = ] schedule_id

나열할 일정의 식별자입니다. @schedule_id 기본값NULL인 int입니다.

@schedule_id 또는 @schedule_name 지정할 수 있습니다.

[ @schedule_name = ] N'schedule_name'

나열할 일정의 이름입니다. @schedule_name sysname이며 기본값은 .입니다NULL.

@schedule_id 또는 @schedule_name 지정할 수 있습니다.

[ @attached_schedules_only = ] attached_schedules_only

작업이 연결된 일정만 표시할지 여부를 지정합니다. @attached_schedules_only 비트이며 기본값은 .입니다0. @attached_schedules_only0경우 모든 일정이 표시됩니다. @attached_schedules_only1결과 집합에는 작업에 연결된 일정만 포함됩니다.

[ @include_description = ] include_description

결과 집합에 설명을 포함할지 여부를 지정합니다. @include_description 비트이며 기본값은 .입니다0. @include_description 0 결과 집합의 @schedule_description 열에는 자리 표시자가 포함됩니다. @include_description1경우 일정에 대한 설명이 결과 집합에 포함됩니다.

반환 코드 값

0 (성공) 또는 1 (실패).

결과 집합

이 프로시저는 다음 결과 집합을 반환합니다.

열 이름 데이터 형식 설명
schedule_id int 식별자 번호를 예약합니다.
schedule_uid uniqueidentifier 일정의 식별자입니다.
schedule_name sysname 일정의 이름입니다.
enabled int 일정 사용 여부() 사용 여부(10).
freq_type int 작업을 실행할 시기를 나타내는 값입니다.

1 = 한 번
4 = 매일
8 = 매주
16 = 매월
32 = 월별로, freq_interval
64 = SQLServerAgent 서비스가 시작될 때 실행됩니다.
freq_interval int 작업이 실행되는 요일입니다. 값은 의 값 freq_type에 따라 달라집니다. 자세한 내용은 sp_add_schedule 참조하세요.
freq_subday_type int 에 대한 단위입니다 freq_subday_interval. 자세한 내용은 sp_add_schedule 참조하세요.
freq_subday_interval int freq_subday_type 작업의 각 실행 사이에 발생할 기간 수입니다. 자세한 내용은 sp_add_schedule 참조하세요.
freq_relative_interval int 예약된 작업의 매월 발생 횟수 freq_interval 입니다. 자세한 내용은 sp_add_schedule 참조하세요.
freq_recurrence_factor int 예약된 작업 실행 사이의 개월 수입니다.
active_start_date int 일정을 활성화하는 날짜입니다.
active_end_date int 일정의 종료 날짜입니다.
active_start_time int 일정이 시작되는 시간입니다.
active_end_time int 하루 일정의 시간이 종료됩니다.
date_created 날짜/시간 일정을 만든 날짜입니다.
schedule_description nvarchar(4000) 일정에 대한 영어 설명입니다(요청된 경우).
job_count int 이 일정을 참조하는 작업 수를 반환합니다.

설명

매개 변수가 제공되지 sp_help_schedule 않으면 인스턴스의 모든 일정에 대한 정보를 나열합니다.

사용 권한

이 저장 프로시저는 db_owner 역할이 소유합니다. 모든 사용자에 대한 사용 권한을 부여 EXECUTE 할 수 있지만 SQL Server 업그레이드 중에 이러한 권한이 재정의될 수 있습니다.

다른 사용자에게는 데이터베이스에서 다음 SQL Server 에이전트 고정 데이터베이스 역할 msdb 중 하나가 부여되어야 합니다.

  • SQLAgentUserRole
  • SQLAgentReaderRole
  • SQLAgentOperatorRole

이러한 역할의 사용 권한에 대한 자세한 내용은 SQL Server 에이전트 고정 데이터베이스 역할을 참조하세요.

SQLAgentUserRole멤버는 자신이 소유한 일정만 볼 수 있습니다.

예제

A. 인스턴스의 모든 일정에 대한 정보 나열

다음 예에서는 인스턴스에 있는 모든 일정에 대한 정보를 나열합니다.

USE msdb;
GO

EXEC dbo.sp_help_schedule;
GO

B. 특정 일정에 대한 정보 나열

다음 예제에서는 이름이 지정된 NightlyJobs일정에 대한 정보를 나열합니다.

USE msdb;
GO

EXEC dbo.sp_help_schedule
    @schedule_name = N'NightlyJobs';
GO