Pass variables to SQL Server job?

I have  a SQL Server job that runs every morning and executes a series of 15 stored procedures.  Each of these SPs pulls data from my clients production database and stores it in a reporting database, but because of the ability of user to modify historical data (as much as 30 days back), I use MERGE procedures in each of these SP to Update and Insert records in the reporting DB.

Each of these SPs have variables @FromDate and @ThruDate defined in the SP allowing me to pass in specific dates, or to use the defaults GetDate() - 30 thru Today.

I like the fact that each of these procedures is run as a separate step of the daily job because occasionally, data entered into the production db will fail due to duplicates which fail the merge process, allowing me to determine where the process failed and investigate the failure.  However, I would like to be able to run the job and pass in a couple of dates, which would be used by all 15 of the SPs.  Is there a way to do this?

I know I can create a separate SP, which would run each of the 15 SPs, but this will not report failure at a specific step.
LVL 50
Dale FyeAsked:
Who is Participating?
 
ste5anConnect With a Mentor Senior DeveloperCommented:
Create a job/control table, where you store the parameters. Read it in your procedures.
0
 
Dale FyeAuthor Commented:
Thanks for your input, ste5an.

I had considered that was looking for other alternatives.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.