SQL Agent Job, Set Values, DTS variables and job rescheduling
Techies-- I have an SSIS job that begins with a script task. The script task accepts the starting datetime and the ending datetime. For qa purposes, my plan is to begin the start datetime @ 7/1/2012 00:00:00 AM and set the end datetime @ 7/1/2012 01:00:00 AM, easy enough--for this I set the values for the sql agent job mapped to the dts variables. Now, here is the real question: How would I automatically reschedule the sql agent job so that when I set it up to run once every hour, the range changes to add an hour from the end datetime of the last run (e.g. 7/1/2012 01:00:00 AM to 7/1/2012 02:00:00 AM) ? Outside of QA testing, the job will normally need to do essentially the same thing--with current datetime variables. I should mention that I am storing the previous start/end range in a control table, so I know I can update the info that way, however, I'm looking for input from the group for alternatives
August 20th, 2012 6:32pm

How does the script consume the input from outside now? To automatically reschedule an Agent job you would need to generate a new one on the fly and drop the old, after all, all Agent jobs are scriptable. A good starts would be to script the existing and then use this script as a foundation to build new ones.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2012 7:43pm

Thanks Arthur-- I decided to avoid direct SSIS/sql agent job parameter input in favor of implementing a range table with an active/inactive flag to accommodate historical extracts (this particular ssis package yanks data from a remote wcf service based on date ranges). I set up a tolerance variable to deal with wcf timeouts on date ranges that span too long. So, the first task in the SSIS package is to look for the most current entry in the range table, if there's an active entry, the range gets set from there; if there's no entry, then the difference between the last excuted batch run and the current time gets tolerance tested--if it fails, the package exits with notification, if it succeeds the package sets the range with the current time and the end date of the last execution, picking up all the data from the remote service in between.
August 25th, 2012 5:13pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics