Solved

MS SQL 2000 : How to invoke/start a scheduled SQL job via stored procedure?

Posted on 2007-11-25
3
1,234 Views
Last Modified: 2010-04-21
Hi,

I have a scheduled job being created in SQL job scheduler (in Enterprise Manager, it is under Management->SQL server agent->Job).  This job (contains many many steps) needs to be run under schedule.  However, it also need to run under user request.

For the scheduled one, no problem.  But for the user request one, we really don't want to duplicate the same set into a stored procedure as this job has many dependences and will notify operator via  email.  As a result, put it again under stored procedure and to do the same will not be a good idea.  My question is : are there any ways to invoke/start the scheduled job manually via stored procedure ?  (I will make this command as a table trigger)

Thanks a lot.

Cheers
Stanley
0
Comment
Question by:StanleyLMW
[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
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
kselvia earned 500 total points
ID: 20348587
Try

exec msdb..sp_start_job @job_name = 'Job Name'

0
 
LVL 12

Expert Comment

by:kselvia
ID: 20348593
Also, you might take a look at this

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_22965040.html

for more info about using that in a trigger.
0
 

Author Closing Comment

by:StanleyLMW
ID: 31410934
Thanks a lot.  It works.  Cheers!  ^_^
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

734 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