question

akhan avatar image
0 Votes"
akhan asked backtothefuture-4787 answered

Anyways to specifiy a schedule for SQL Elastic Job ?

Hi i am working with SQL Elastic Jobs and the only way to schedule a job is as follows - which sets the schedule to run at everyday but there is no option to specify what time to run it on every day and seems to default to when the following statement was run. so if this was run at 10:30 am the schedule will set the job to run at 10:30 am every day. Is there any way to specify a time to make it run at 4:00 am everyday ?

EXEC jobs.sp_update_job
@job_name='Run Sample Job',
@enabled=1,
@schedule_interval_type='Days',
@schedule_interval_count=1

Thanks

azure-sql-database
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

akhan avatar image
0 Votes"
akhan answered

For anyone curious this can be done by using the @scheduled_start_time parameter - updated code below

EXEC jobs.sp_update_job
@job_name='Run Sample Job',
@enabled=1,
@schedule_interval_type='Days',
@schedule_interval_count=1,
@schedule_start_time='2021-09-21 11:00:00' (sets time to 4:00am PST, adjust time accordingly)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

backtothefuture-4787 avatar image
0 Votes"
backtothefuture-4787 answered

something I found useful to know., and be careful with, .. if you specify a schedule_start_time that is in the past the job will execute immediately

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.