Thursday, 7 May 2009

TSQL: Email Notifications

Method 1:

When setting up a new SQL job, you can add additional steps after the job has run.

In the command area, type in the following to send an email:

exec master.dbo.sp_sqlnotify '[from email]','[to email 1];[to email 2]','[subject]','[msg body].'



Setup 2 additional steps, one for failure and one for success (only if you want to be notified on success), point the actions on Step 1 to the additional steps.








No comments: