Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
haseena
Starting Member
2 Posts |
Posted - 2009-04-21 : 19:36:05
|
| Hello Friends,Looking for a script which sends out an email if a column is updatedwith a specific word in it. I tried something but unfortunately it is not working.I would really appreciate if someone helps me in this.Thank YouMy codedeclare @ASCode varchar(100)select @ASCode=AAStatusCode from Station.dbo.storeif @ASCode ='FAIL'BeginEXEC msdb.dbo.sp_send_dbmail@recipients=N'haseena@yahoo.com',@body=ascode is failed. TEST.. IGNORE', @subject =ascode is failed. TEST IGNORE',@profile_name ='haseena_SendEmail'end |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2009-04-21 : 20:06:23
|
| create a trigger to add a row to a table if that word exists and have a job which polls the table and sends the email.The trigger will be something likecreate trigger xxxx on xxxxx for updateasif exists (select * from inserted where col like '%myword%')==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2009-04-21 : 20:08:53
|
| ceate trigger xxxx on store for update asif exists (select * from inserted where AAStatusCode = 'FAIL'begin....endBetter to insert a row into a table from the trigger and use a job to poll that table to send the email.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|