Running ETL Script at End of Month

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

  1. Open the script / project you want to execute
  2. 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)

  3. 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'
     exit 0    /* If we're not at the end of the month then exit */
end if    

end if
Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.