Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Creating a stored procedure from a collection of SQL jobs

$
0
0

Hi All,

So I've been set a challenge by my team leader to try and improve the efficiency of some of our SQL jobs on a test system (obviously eventually to live but test for now).

Basically we have a series of 7 jobs that truncate some transfer tables and reload fresh data from the main database in to them ready for transfer to a different system.

She would like to get rid of the jobs and just make a stored procedure that does the same thing. As I've been enthusiastic about learning more about SQL she asked if I would do it as a learning experience. I honestly didn't even know where to start so pulled the SQL out of the jobs and have trimmed it down a bit (they all reference the same database so I only need one reference to the database etc) and gone from there.

At the moment the script is looking like the following:

Use *database*

truncate...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>