Sometimes it may be necessary to run a job multiple times at the end of the month. The scheduler in InMemory does at this time not support this, however this can be done by setting up a regular schedule and letting scripting determine whether it should run or not.
Step-by-step guide
This requires that you are a developer and have access to modify the schedule of the job
- Open the script / project you want to execute
- In the schedule dialog add a new script and set the frequency for it to run. In this example the schedule will run every day and set the @param1 parameter for the script to endofmonth (see the arguments-box)
- Create a scripting block and adjust the code to work within your requirements.
if @param1='endofmonth' then
declare @endofmonthdate as datetime
set @endofmonthdate={select dateadd(month,1,date())-day(date())}
print 'End of month is '+@endofmonthdate
if @endofmonthdate=date() then
print 'Day is end Of Month'
else
exit 0 /* If we're not at the end of the month then exit */
end if
end if
Comments
Please sign in to leave a comment.