FW: Getting the JobID and jobname within the steps of the same JO B

FW: Getting the JobID and jobname within the steps of the same JO B

 

  

> Hi,
>
> I am trying to automate the alerting to multiple DBAs and monitoring
> people. Hence, want to use "raiserror" with a custom message with the
> details of the server, jobid,jobname, and error message
>
> I know that the server name can be got from @@servername
>
> RAISERROR (99999, 17, 1, @@servername,null,null)
>
> How do I get the jobid, jobname and error message for the failure.
>
> Regards,
>
> Sathish
MS Sql Server LazyDBA home page