SQLTeam.com | Weblogs | Forums

Poll table for condition

sql2012

#1

I have a need to poll one of our tables for a specific condition, and then email me to respond. I'd like to set this up in sql agent. Basically would like to run this query "SELECT * FROM PSAPMSGSUBCON WHERE SUBCONSTATUS =3 and STATUSSTRING ='WRKNG' and run this like ever 30 minutes.

Appreciate ideas.


#2

Create a filtered index on the PSAPMSGSUBCON table containing subconstatus and statustring.

Create a job to run every 30 minutes that does the query and then sends you an email: exec msdb..sp_send_dbmail.


#3

thanks