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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Stop job query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

HelloRachel
Starting Member

4 Posts

Posted - 05/12/2011 :  14:34:22  Show Profile  Reply with Quote
Hello All -

I am looking for a T-SQL to stop the job after 15 min automatically. Sometimes it happens if i try to stop the job mannually it won't stop and kept running.

Thanks much for the help inadvance.

Rachel

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1754 Posts

Posted - 05/12/2011 :  16:50:04  Show Profile  Reply with Quote
Have you looked into the sp_stop_job system stored procedure? Details are in BOL. If you can't stop the job manually, however, this might not be of much use.


=======================================
Elitism is the slur directed at merit by mediocrity. -Sydney J. Harris, journalist (1917-1986)
Go to Top of Page

HelloRachel
Starting Member

4 Posts

Posted - 05/13/2011 :  16:49:22  Show Profile  Reply with Quote
Yes I have tried using the code but also as you said I cannot manually stop the job then its of no use.
Isn't there any other way or query I can write.

Thanks
Racel
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
37129 Posts

Posted - 05/13/2011 :  17:13:56  Show Profile  Visit tkizer's Homepage  Reply with Quote
What is the job doing for the one that can't be stopped?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

HelloRachel
Starting Member

4 Posts

Posted - 05/16/2011 :  12:41:00  Show Profile  Reply with Quote
The purpose of the job is refreshing the tab from the server in the excel. When I try to stop it manually it hung up there and shows status "Executing"...and not doing anything for hours. That's the reason I need a T-SQL code or something to stop the job with that like if it ran for more than 10 minutes it will stop automatically.

Please help me out with this. I am really looking for a code or something that will help me stop the job.

Thanks much in advance
Rachel!
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
37129 Posts

Posted - 05/16/2011 :  13:07:33  Show Profile  Visit tkizer's Homepage  Reply with Quote
The only thing you can do on the SQL side is to kill the spid.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

HelloRachel
Starting Member

4 Posts

Posted - 05/16/2011 :  14:06:30  Show Profile  Reply with Quote
Thank you tara for the quick response.
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.08 seconds. Powered By: Snitz Forums 2000