SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Script for Stop the Job if running and disable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

snivas
Starting Member

India
9 Posts

Posted - 12/06/2011 :  09:43:16  Show Profile  Reply with Quote
Dear all,

I am not familiar with Progamming,
I need help from guru's
I want a script which can stop the Jobs If jobs are running and disable jobs,If Job is not running script should Disable the Job.

can some help me with script it is greate help for me.


Thanks in advance

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/06/2011 :  10:43:17  Show Profile  Reply with Quote
use sp_stop_job to stop a job programatically

for disabling enabling see

http://www.mssqltips.com/sqlservertip/1400/disabling-or-enabling-sql-server-agent-jobs/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

snivas
Starting Member

India
9 Posts

Posted - 12/07/2011 :  06:29:41  Show Profile  Reply with Quote
Hey visakh

If I disable the Job which is running it will stop the Job ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/07/2011 :  06:42:24  Show Profile  Reply with Quote
quote:
Originally posted by snivas

Hey visakh

If I disable the Job which is running it will stop the Job ?


nope it wont
the current run will still be completed
further runs wont occur

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000