0

I'm using two stored procedures a view to create report.

Every 3 months, I have to update these two stored procedures and view automatically.

First, I should update stored procedure 1

Then, I need to update view (it takes data from stored procedure 1)

Finally, I need to update stored procedure 2 (it takes data form stored procedure 1 and from the view)

To do this, I would like to use SQL Server Agent jobs. Is it possible to run one SQL Server Agent job and updated these two store procedure and view in that sequence? or should I create SQL Server Agent job with command to update stored procedure 1 then I need to create another job with command to update view and then create another job with command to stored procedure 2.

Thank you for any suggestions.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Amelia K
  • 61
  • 1
  • 6
  • My first question is why do you need to update the SP or view, the SP/View should be written to be able to handle the different needs of the report. Explain more of why you think you need to change the code to enable reporting every 3 months. – Dbloch Nov 24 '14 at 20:50

1 Answers1

0

Yes, the tasks that are described in the question can be done with one single SQL Server Agent Job.
For this SQL Server Agent Job you may want to set several steps
- Step 1: run SP1
- Step 2: update view
- Step 3: run SP2)
OR actually create only one step that will have all the actions inside. Also, the job should have the 3 months schedule created as needed.
Note: you refer as "update stored procedure 1" .. I think you actually mean "execute stored procedure 1".

For further documentation I recommend: http://msdn.microsoft.com/en-us/library/ms190268(v=sql.105).aspx

Eduard Uta
  • 2,477
  • 5
  • 26
  • 36