I would create a task table to enter my tasks.
taskTable |taskID |Freq |runAt | ------------------------------- |1 |daily |1 | |2 |daily |0 | |3 |weekly |5 | |4 |weekly |1 | |5 |monthly|15 | |6 |monthly|1 | |7 |once |2013-7-4 |
runAt for daily newspapers is never considered, so it doesn't matter what value is entered.
runAt for weekly items is the day of the week on which the task should run.
runAt for mothly is the day of the month on which the task should be executed (the tasks of the end of the month, which I usually start on the first, as it saves the hassle of which day the month ends, although you can use this to understand that out of
lastDayOfMonth = datePart(d,dateadd(s,-1,dateadd(mm, datediff(m,0,getdate())+1,0)))
runAt for once is the day the task should run.
Then I will create a task for daily work to see what needs to be launched.
select taskID from taskTable where (freq = 'once' and runAt = convert(varchar(10),getDate(),21)) or freq = 'daily' or (freq = 'weekly' and runAt = datePart(dw,getDate())) or (freq = 'monthly' and runAt = datePart(d,getDate())
This request gives me all the taskID for any tasks that I need to complete.
Not sure if this is what you were looking for, but hopefully you will find something useful in it.
Lance
source share