Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-12-02
7
Medium Priority
?
450 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 1000 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
What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

 
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 25

Assisted Solution

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

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

It is a start job and wait proc.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

705 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