Dale Fye
asked on
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had considered that was looking for other alternatives.