Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Stop job query

Author  Topic 

HelloRachel
Starting Member

4 Posts

Posted - 2011-05-12 : 14:34:22
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
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2011-05-12 : 16:50:04
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 - 2011-05-13 : 16:49:22
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

38200 Posts

Posted - 2011-05-13 : 17:13:56
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 - 2011-05-16 : 12:41:00
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

38200 Posts

Posted - 2011-05-16 : 13:07:33
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 - 2011-05-16 : 14:06:30
Thank you tara for the quick response.
Go to Top of Page
   

- Advertisement -