Re: Job Runtime Conversion Using T-SQL
- From: "Rubens" <rubensrose@xxxxxxxxxxx>
- Date: Thu, 17 Sep 2009 13:56:35 -0400
I did find this in BO actually, I'm hoping this seems correct and is the reply I provided.
Sure. Based on the below, here is what I gather.
@enabled=1, -- Enabled
@freq_type=4, -- Daily
@freq_interval=1, -- Once
@freq_subday_type=1, -- At the specified time
@freq_subday_interval=0, -- Ignored
@freq_relative_interval=0, -- Ignored
@freq_recurrence_factor=0, -- Ignored
@active_start_date=20020506, -- 2002-05-06; May 6th, 2002
@active_end_date=99991231, -- 9999-12-31; No end date
@active_start_time=42000, -- Format HHMMSS; 4:20 am
@active_end_time=235959, -- Format HHMMSS; 11:59:59 pm
Check out this article in BO for future reference: ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/97b3119b-e43e-447a-bbfb-0b5499e2fefe.htm
sp_add_schedule [ @schedule_name = ] 'schedule_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' ]
[ , [ @schedule_uid = ] schedule_uid OUTPUT ]
[ , [ @schedule_id = ] schedule_id OUTPUT ]
[ , [ @originating_server = ] server_name ] /* internal */
Arguments
[ @schedule_name = ] 'schedule_name'
The name of the schedule. schedule_name is sysname, with no default.
[ @enabled = ] enabled
Indicates the current status of the schedule. enabled is tinyint, with a default of 1 (enabled). If 0, the schedule is not enabled. When the schedule is not enabled, no jobs will run on this schedule.
[ @freq_type = ] freq_type
A value indicating when a job is to be executed. freq_type is int, with a default of 0, and can be one of these values.
Value Description
1 Once
4 Daily
8 Weekly
16 Monthly
32 Monthly, relative to freq_interval
64 Run when SQLServerAgent service starts
128 Run when the computer is idle
[ @freq_interval = ] freq_interval
The days that a job is executed. freq_interval is int, with a default of 1, and depends on the value of freq_type.
Value of freq_type Effect on freq_interval
1 (once) freq_interval is unused.
4 (daily) Every freq_interval days.
8 (weekly) freq_interval is one or more of the following (combined with an OR logical operator):
1 = Sunday
2 = Monday
4 = Tuesday
8 = Wednesday
16 = Thursday
32 = Friday
64 = Saturday
16 (monthly) On the freq_interval day of the month.
32 (monthly relative) freq_interval is one of the following:
1 = Sunday
2 = Monday
3 = Tuesday
4 = Wednesday
5 = Thursday
6 = Friday
7 = Saturday
8 = Day
9 = Weekday
10 = Weekend day
64 (when SQLServerAgent service starts) freq_interval is unused.
128 freq_interval is unused.
[ @freq_subday_type = ] freq_subday_type
Specifies the units for freq_subday_interval. freq_subday_type is int, with a default of 0, and can be one of these values.
Value Description (unit)
0x1 At the specified time
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_interval is int, with a default of 0. freq_subday_interval is ignored in those cases where freq_subday_type is equal to 1.
[ @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_interval is int, with a default of 0, and can be one of these values. freq_relative_interval is ignored in those cases where freq_type is not equal to 32.
Value Description (unit)
1 First
2 Second
4 Third
8 Fourth
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_factor is int, with a default of 0.
[ @active_start_date = ] active_start_date
The date on which execution of a job can begin. active_start_date is int, with a default of NULL, which indicates today's date. The date is formatted as YYYYMMDD. If active_start_date is not NULL, the date must be greater than or equal to 19900101.
After the schedule is created, review the start date and confirm that it is the correct date. For more information, see the section "Scheduling Start Date" in Creating and Attaching Schedules to Jobs.
[ @active_end_date = ] active_end_date
The date on which execution of a job can stop. active_end_date is int, with a default of 99991231, which indicates December 31, 9999. Formatted as YYYYMMDD.
[ @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_time is 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_time is 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.
[ @schedule_uid= ] schedule_uid OUTPUT
A unique identifier for the schedule. schedule_uid is a variable of type uniqueidentifier.
[ @schedule_id= ] schedule_id OUTPUT
An identifier for the schedule. schedule_id is a variable of type int.
[ @originating_server= ] server_name
Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.
"Rubens" <rubensrose@xxxxxxxxxxx> wrote in message news:77423E15-7520-4765-8FB4-82C3D3254A17@xxxxxxxxxxxxxxxx
I've been asked an interesting question by someone that I do not know the answer to and was wondering if someone can help me out. Ideally it would be nice if I could reply with the coding that does the proper conversions along with answering the question. The question is...
How can I figure out the runtime of this (a stored procedure) with the information below?
@enabled=1,
@freq_type=4,
@freq_interval=1,
@freq_subday_type=1,
@freq_subday_interval=0,
@freq_relative_interval=0,
@freq_recurrence_factor=0,
@active_start_date=20020506,
@active_end_date=99991231,
@active_start_time=42000,
@active_end_time=235959,
Thanks,
Rubens
.
- References:
- Job Runtime Conversion Using T-SQL
- From: Rubens
- Job Runtime Conversion Using T-SQL
- Prev by Date: Job Runtime Conversion Using T-SQL
- Next by Date: Re: Job Runtime Conversion Using T-SQL
- Previous by thread: Job Runtime Conversion Using T-SQL
- Next by thread: Re: Job Runtime Conversion Using T-SQL
- Index(es):
Relevant Pages
|