June 13, 2012 at 6:27 am
Could someone explain to me why this try catch still returns an error if the job is not running? It never goes to the catch statement.
begin try
exec msdb..sp_stop_job @job_name = '_Test'
print 'Stopping Job: ' + '_Test'
end try
begin catch
print 'Not Running'
end catch
/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!
June 13, 2012 at 7:05 am
I believe it's because sp_stop_job calls an extended procedure and it can't catch the error to return it to the catch block.
There's a connect bug for it, which lists a couple of clunky workarounds:
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply