views:

118

answers:

2

Hi

i have created a job that contain the command "select * from employ" from user databse.

when this query executed succesfully i hav to get alert by mail.how to do this

+3  A: 

Follow instructions here (http://weblogs.sqlteam.com/randyp/archive/2009/03/04/60863.aspx), but lastly check 'success' instead of 'failed'.

Citation:

  • Run SQL Server Surface Area Configuration - > Surface Area Configuration for features -> Select Database Mail - > Check Enable Database mail stored procedures.
  • Open SQL Management Studio - > Management - > Database mail - > Configure SMTP Settings.
  • Go to SQL Server Agent - > Operators - > Create New Operator
  • Go to SQL Job - > In the Notifications, Check email and select the Operator. You can either select the option to send notification if job fails / succeeds/ completed.

More about SQL mail: http://www.sql-server-performance.com/articles/dba/email_functionality_p1.aspx

boj
A: 

There are lots of notification options in the job's properties available in SQL Server Management Studio.

For email notifications you need to configure the Server with information to enable it to send emails.

Richard