SQLAgent job with different schedules

372 views Asked by At

I am looking to see if its possible to have one job that runs different schedules, with the catch being one of the schedules needs to pass in a parameter.

I have an executable that will run some functionality when there is no parameter, but if there is a parameter present it will run some additional logic.

Setting up my job I created a schedule (every 15 minutes), Operating system (CmdExec) runApplication.exe

For the other schedule I would like it to be once per day however the executable would need to be: runApplication.exe "1"

I dont think I can create a different step with a separate schedule, or can I? Anyone have any ideas on how to achieve this without having two separate jobs?

1

There are 1 answers

2
Isaiah3015 On BEST ANSWER

There's no need for 2 jobs. What you can do is update your script so the result of your job (your parameter) is stored in a table. Then update your secondary logic to reference that table. If there's a value of parameter, then run your secondary logic. All in one script. If there's no value in that parameter, then have your secondary logic to return a 0 or not run at all.

Just make sure you either truncate the entire reference parameter table every run or you store a date in there so you know which one to reference.

Good luck.