Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Select the last error in the job selected

By Ludwig Guevara,

The job will send an HTML email with the latest error at specific job.

How to:

  1.  Add a last step at your already created job called "Send Failure Notification" pointing to the Database where you have the previous script.
  2.  in the Command window put:

-- Send Failure Notification
<msdb>.dbo.usp_JobErrorMessage

-- Required parameter to whom are you sending this email

'<group or name>@<company>.com'

-- Required parameter - job_id

, '<job_id>'

-- Optional parameter - default is 1 minute
, <Minutes>

-- Optional parameter - default is low
, <level of importance>

SAMPLE:

[DBEM].dbo.usp_JobErrorMessage

'vonpato@yahoo.com'

, 'E1A5E99B-3A30-40D5-B32D-89DBC78936DB'

Total article views: 862 | Views in the last 30 days: 1
 
Related Articles
FORUM

Parameter to Parameter

Parameter Values

FORUM

Parameter Dependency

Parameter Dependency

FORUM

Parameter issue

Parameter issue

FORUM

Multiple parameters

Multiple parameters

FORUM

Multiple report parameters

Parameter dependency

Tags
job history    
sql jobs    
t-sql    
 
Contribute