Creating a scheduled job

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

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

StepsCreating a scheduled job that gathers statistics on a trial basis for one month

  1. Create the schedule:�

    sp_sjobcreate @name='sname=Aug_stats_trial',�
    @option='starttime=23:00,endtime=23:00,repeats=1day,startdate=1 August�
    2005,enddate=31 August 2005'�
    
  2. Create the job:

    sp_sjobcreate @name='jname=new_stats_proc',�
    @option='jcmd=''exec statsdb..
    new_stats_proc'',jdesc=New statistics�
    proc.,jproperties=shared'�
    
  3. Create a scheduled job on a server called “devtest1”:

    sp_sjobcreate @name='sjname=new_stats_devtest1', 
    @option='sname=Aug_stats_trial,jname=new_stats_proc,server=devtest1'�
    

    NoteThe server name assigned to the scheduled job is the network name (the pname property in sp_addserver) in the interfaces file, not the logical name defined in the sysservers table.