Solved

Stored Proc to kick off the job and wait till it completes

Posted on 2013-12-02
7
432 Views
Last Modified: 2014-01-03
Hi Experts,

I need your help in creating a stored procedure which will kick off a sql server job (job has multiple steps). Using "msdb.dbo.sp_start_job" will just kicks off the job. But I want my stored procedure to kick off the job and wait till it completes.

I do not want to use WAITFOR DELAY function.

Please help me out!!

Thanks in advance!
0
Comment
Question by:ravichand-sql
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 39691415
why do you want to wait for the job?
why not use waitfor delay?

maybe you could use the internal queues for that
have the stored procedure start the job and then wait for a message in a queue (which the job will place in it's last step) but it is very complicated
0
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 250 total points
ID: 39697536
Does your stored procedure need to use information that is generated by your job?

I would put the code that follow the msdb.dbo.sp_start_job inside another stored procedure and then execute this stored procedure as the last step of your job.
0
 

Author Comment

by:ravichand-sql
ID: 39750392
Hello Moderator,

Please close this question, as I have not got the required answer and I do not need help in this question.

Sorry for the late response
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39750489
ravichand-sql,

Please close this question
That is your responsibility.  You should request that the thread be deleted and if no one objects it will be done.

Next time try and participate by providing meaningful feedback instead of abandoning the question.
0
 

Author Comment

by:ravichand-sql
ID: 39750523
I am so sorry about this, and will not be repeating this again..
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 39751893
And?, my answer contains a reasonable approach to accomplish the task?, why this question would be closed without any points?
0
 
LVL 24

Assisted Solution

by:DBAduck - Ben Miller
DBAduck - Ben Miller earned 250 total points
ID: 39754989
I use this.

http://blog.boxedbits.com/archives/124

It is a start job and wait proc.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question