selectstarfromyogi

sql server DBA ,sql server 2008 , 2012 , 2014 ,sql

Menu
Search
Skip to content
  • Home
  • About

kill job using tsql

Kill the job if it took more than 20 min to execute – SQL Server

if (select a.run_duration from msdb.dbo.sysjobhistory a join msdb.dbo.sysjobs b on a.job_id= b.job_id where b.name like ‘test’ and a.step_id =1 and
a.run_date >= cast (convert( varchar(10),getdate(),112) as int) ) > 1200
exec dbo.sp_stop_job ‘test’
else
print ‘The job is not currently running’

September 28, 2016yogigollapudi kill job using tsql, sp_stop_Job, stop job using tsql, tsql to stop the job Leave a comment

Categories

  • DEVOps (1)
  • Errors (9)
  • FUN (1)
  • Performance Tuning (11)
  • powershell (12)
  • T-SQL (43)
  • Uncategorized (154)

Blog Stats

  • 39,566 hits
Follow selectstarfromyogi on WordPress.com
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • selectstarfromyogi
    • Already have a WordPress.com account? Log in now.
    • selectstarfromyogi
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
Design a site like this with WordPress.com
Get started