Jobs and Schedules#

Querona runs user-defined, recurring tasks as jobs, with a job model that mirrors SQL Server’s. You can manage jobs from the web GUI or in SQL.

The pieces fit together like this:

  • A job is an ordered list of steps. Each step runs an arbitrary SQL command on a target database; an on-success and an on-fail action then decide what happens next — continue to the next step, jump to a specific step, or quit.

  • A schedule defines when a job runs — once, or on a daily, weekly or monthly recurrence, down to a sub-day interval.

  • Jobs and schedules link many-to-many: a schedule can drive several jobs and a job can carry several schedules — and a job can also be started on demand.

Note

Job and schedule functionality (the equivalent of SQL Server Agent) is built into Querona — there is no separate agent service to install, configure, or run. The familiar sp_add_job / sp_add_schedule stored procedures work out of the box.

Schedules#

Schedules can be found under Administer ‣ Schedule management.

The screen supports searching. A new schedule can be defined by clicking the Add schedule button.

The following schedule types apply. In SQL, the type is the @freq_type argument of sp_add_scheduleOnce (1), Daily (4), Weekly (8, with @freq_interval for the days of the week) or Monthly (16, with @freq_interval for the day of the month). Sub-day recurrence uses @freq_subday_type and @freq_subday_interval.

Once#

The linked job will be run once on the given day/time.

exec sp_add_schedule @schedule_name = 'once_on_jul_1',
    @freq_type = 1,                -- once
    @active_start_date = 20260701, -- on 2026-07-01
    @active_start_time = 130000    -- at 13:00:00

Daily#

Scheduled tasks will be run once or more than once per day on a given time.

  • Recurs every N days means a given tasks will be run every n days.

  • Daily frequency can be set a specific time of day or a recur value (e.g. Every N minutes) with additional daily time bounds.

  • Start date and optional End date can be used to globally limit the schedule time span.

exec sp_add_schedule @schedule_name = 'every_15_minutes',
    @freq_type = 4,            -- daily
    @freq_interval = 1,        -- every day
    @freq_subday_type = 4,     -- subday interval in minutes
    @freq_subday_interval = 15 -- every 15 minutes

Weekly#

This schedule is used to configure tasks to be run on particular days of the week.

It behaves the same way as the daily schedule except for multiple days of the week can be selected.

exec sp_add_schedule @schedule_name = 'weekdays_at_8am',
    @freq_type = 8,              -- weekly
    @freq_interval = 62,         -- Mon+Tue+Wed+Thu+Fri (2+4+8+16+32)
    @freq_recurrence_factor = 1, -- every week
    @active_start_time = 80000   -- at 08:00:00

Monthly#

To run a job on given day of the month this option is the right choice.

Again, either a specific time or time-bound recurrence can be selected.

exec sp_add_schedule @schedule_name = 'day_15_each_month',
    @freq_type = 16,             -- monthly
    @freq_interval = 15,         -- on the 15th day
    @freq_recurrence_factor = 1, -- every month
    @active_start_time = 90000   -- at 09:00:00

Jobs#

Jobs can be found under Administer ‣ Job management.

Jobs management screen

The screen supports searching. A new job can be defined by clicking the Add job button, or in SQL with sp_add_job.

Input a name and description and click Create. This will cause the job to be saved and appear on the list.

Click the job on the list to access the details pane. In the bottom, you will find 3 sub-blades that allow tuning of the job details.

The Start job button allows running the job at any time, including starting a job at a given step — in SQL, sp_start_job.

Clicking Steps brings up the job step configuration screen. A single job can consist of any number of step. A new step can be defined by clicking the Add step button.

The following table summarizes the parameters:

Parameter

Description

Default value

Step Id

Auto-generated Id of the step, used for jumps (see below).

Step Name

A user-friendly name of the step.

Command

An arbitrary SQL to be run on the target database.

On success action

The action to be performed when the step succeeds. Choosing Go to specified step allows to set the Id of the target jump step.

Go to next step

On fail action

The action to be performed when the step fails. Choosing Go to specified step allows to set the Id of the target jump step.

Quit with failure

Database name

The target database that this step will run on.

Clicking Save will save the step and return to the step list.

In SQL, add steps with sp_add_jobstep: the on-success / on-fail actions and their jump targets map to its @on_success_action / @on_fail_action and @on_success_step_id / @on_fail_step_id arguments, and the target database to @database_name. The action codes are 1 (quit with success), 2 (quit with failure), 3 (go to the next step) and 4 (go to the step named in @on_success_step_id / @on_fail_step_id). For example, a load step that continues on success but branches to a cleanup step on failure:

exec sp_add_jobstep @job_name = 'nightly_refresh', @step_name = 'load',
    @command = 'exec myschema.load_daily_data',
    @database_name = 'Warehouse',
    @on_success_action = 3, -- go to next step
    @on_fail_action = 4,    -- on failure, jump to step 2
    @on_fail_step_id = 2

exec sp_add_jobstep @job_name = 'nightly_refresh', @step_name = 'cleanup',
    @command = 'exec myschema.cleanup',
    @on_success_action = 1, -- quit with success
    @on_fail_action = 2     -- quit with failure

Past execution attempts of a given job can be found under Execution history.

The Schedules section allows to link an arbitrary number of Scheduler to the given job:

This can be achieved by clicking the Add schedule button and picking the proper positions — in SQL, sp_attach_schedule.

Manage jobs in SQL#

Querona exposes SQL Server–compatible stored procedures for every part of the job lifecycle, so the scripts and tools you already use carry over:

Purpose

Stored procedures

Create

sp_add_job, sp_add_jobstep, sp_add_schedule, sp_attach_schedule

Run

sp_start_job, sp_stop_job

Inspect

sp_help_job, sp_help_jobstep

Change

sp_update_job, sp_update_jobstep, sp_update_schedule

Remove

sp_delete_job, sp_delete_jobstep, sp_delete_schedule, sp_detach_schedule

For each procedure’s parameters — including the sp_add_schedule frequency codes (@freq_type, @freq_subday_type, …) — see the Jobs reference.

The following example defines a job, adds a step, creates a schedule, attaches it, and runs the job once:

exec sp_add_job @job_name = 'myjob'

exec sp_add_jobstep @job_name = 'myjob', @step_name = 'step1', @command = 'select 1'
exec sp_add_schedule @schedule_name = 'every_10_seconds',
    @freq_type = 4,            -- daily
    @freq_subday_type = 2,     -- subday interval seconds
    @freq_subday_interval = 10 -- every 10 seconds

exec sp_attach_schedule @job_name = 'myjob', @schedule_name = 'every_10_seconds'
exec sp_start_job @job_name = 'myjob' -- execute job once

See also#

  • Jobs — the job stored-procedure reference.

  • Running jobs — watch jobs that are currently running.