开发者

Scheduling job in sql server mgmt studio to run for 'x' days in a month

How do I run a job in Sql Server Agent in (SQL Server Management Studio) for 'x' number of days in a month?

eg: Every 1st.2nd and 3rd of every month

The problem is I am not sure of these days! The user will specify the 'x' number of days!

For instance, the user feels for the month of April he wants the job to be scheduled on 'x' days. Here x= 1st,2nd and 4th of April.

And for the month May he feels to sc开发者_运维技巧hedule on 'x' days. Here x= 7th,8th and 10th!

Is it possible to schedule in such a way?

Is there any script to schedule this???


Make a schedule that's run on those three days. Assign this job to that schedule.

(To elaborate and make it perfectly clear). Make three schedules (Rightclick Jobs, Manage Schedules).In new schedules choose - Recurring on monthly. One starts the 1st, one starts the 2nd, one starts the 3rd of every month (for example, or x times for whatever day of month you wish).

Name these schedules something that's easy for you to spot in a list.

On the job you wish to run on these days, properties on it, schedule, then pick the schedule(s) you want to assign to the given job.

That should be all.


If the schedule is user defined then I'd probably just schedule the job to run every day and have the first step be to check whether it should be running today and if not exit.


Check Howto Schedule a Job and follow the Instructions of cairnz.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜