Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 839 | Views in the last 30 days: 2
 
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

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones