I have a sql agent job "LoadfromOracle" which loads data from oracle to sql server tables(Orders table, Marketing table ) everyday. This job runs everyday at 7:00 am (Avg Execution time is 1 hour), so completes at 8:00 am.
I have a report named "daily report" which uses Orders table, Marketing table to fetch the required data. we had created subscription for this report ("daily report") and this report is send to executives everyday as an email attachment at 8:20 am.
Problem : some times the sql agent job "LoadfromOracle" is taking more time(4-5) hours to complete data load into Orders table, Marketing table. So, without complete data into Orders table, Marketing table the report ("daily report") is using incomplete data and email is sent to executives with wrong/incomplete data at 8:20 am.
My question : Can I include this report subscription(process of sending report as email) as a SQL AGENT JOB STEP in sql agent job "LoadfromOracle". ???? so that in sql agent job "LoadfromOracle" i have
step1: loading data from oracle to sql server
step2: sending report to subscribers as an email attachment
For step1 i will include OnFailureAction = "Quit the job reporting failure".
By doing this i can be sure that unless the data load is completed, the report won't be sent to executives. and if step1 fails then step2(sending report) step will not be executed.
Can any one give me advice on implementing this??
Thanks for your time!!