Creating a schedule

The following code example shows how to create a schedule in Job Scheduler on the command line. You can perform the same task using the ASE plug-in in the Sybase Central management tool.

When you create a repeating schedule, it must have a start time and an end time.

NoteWhen you create a name for a schedule, the name must begin with a letter. If you create a name beginning with a digit, an error occurs.

The following example creates a schedule that operates every five minutes, between 08:00 and 18:00, and is valid every day of the week:

sp_sjobcreate @name='sname=every5m_8to6',@option='repeats=5minutes, startime=08:00am, endtime=18:00'

The following example creates a schedule that operates every hour on Saturdays and Sundays between 08:00 and 18:00:

sp_sjobcreate @name='sname=hourly_8to6_weekends',
@option='repeats=1hour,starttime=08:00am,endtime=18:00,days=Saturday:Sunday

The following example creates a schedule that operates at 04:00am on the first and last day of every month, where 32 is the last day of the month:

sp_sjobcreate @name='sname=run_4am_1st_and_last',
@option='starttime=04:00,endtime=04:00,dates=1:32'

The following example creates a schedule that operates at 09:00, beginning the first of January and ending the first of February:

sp_sjobcreate @name='sname=run_daily_9am_Jan',
@option='starttime=09:00,endtime=09:00,repeats=1day,startdate=1 January 2005,enddate=1 February 2005'

NoteThe schedule start time is inclusive—a job will begin at the start time. The schedule end time is exclusive—a job will run up to but not include the end time. For example, if a schedule has a start time of 13:00 and an end time of 16:00 and repeats every hour, it run at 13:00, 14:00, and 15:00, but not at 16:00.