question

jacobmat9 avatar image
jacobmat9 asked

stopping scheduled jobs at once and only running few

I have n upcoming project where the scheduled jobs has to be stopped by 2:00pm and only couple jobs has to be run at that time. In those couple jobs, one of them got multiple steps and only the 1st step has to be run. probably i can change the settings "On Success action" "quit the job reporting success" I thought of stopping the sql server agent, but that will stop all the jobs. I created couple of new jobs which only runs the 1st step. I cannot go and manually stop all the jobs and run only the 2 which i wanted. so how can i do it ?
jobsschedule
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
CirqueDeSQLeil avatar image
CirqueDeSQLeil answered
The easiest would be to create a script that disables all enabled jobs, and records which jobs were disabled (insert a record into a table). Then alter the two jobs to quit reporting success after the first step as you mentioned. Then at the end of your window (assuming some sort of maintenance is being done and thus the need to disable the jobs), run another script that re-enables the jobs that were disabled and logged to your table (just read from that table to figure out what needs to be enabled).
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jacobmat9 avatar image jacobmat9 commented ·
i am not good at creating scripts.. new in this field.
0 Likes 0 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
No better time than the present to start practicing then.
0 Likes 0 ·
jacobmat9 avatar image jacobmat9 commented ·
Thanks Grant, i have considered your suggestion. Tell me where to start.. vb, c# ??
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.