Make SQL Agent job steps fail

  • Dear All,

    I have SQL Agent jobs which consist of a number of stored procedures. Each stored procedure does some checking of input data before doing the bulk of its work: if the data is not good I would like to RETURN a non-zero value or RAISERROR or similar. I would like to be able to halt the whole job if one stored procedure exits in this way hence have set 'On failure quit the job reporting failure' for all steps. Unfortunately non of these exit methods (RETURN > 0, RAISERROR) seem to constitute a step failing.

    Does anybody have any advice on what constitues a step failure?

    Stephen

  • SOLVED

    I have raised the severity of my RAISERROR to > 18 which means it is fatal to the job.

  • I think that severity 16 should also do the trick

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Adi Cohn (9/1/2009)


    I think that severity 16 should also do the trick

    Adi

    Severity 16 has the added advantage of not requiring the elevated rights that severities > 18 necessitate.

    Thanks Adi

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply