What's the best way to alert me of a particular value appearing in a table field

  • I have a data warehouse that is refreshed on a nightly basis. I want to be alerted if any records appear after each data refresh that have a field in a table equal to a specific value. Seems a bit extreme to set up an ssrs report or do something in ssis to check. Is there a better way of doing this? I would imagine I'm being a little dull here and not seeing the obvious!

  • How about a sql agent job that runs after the refresh that checks for the value and sends an email using database mail if the value exists. Your job could have something like this in it:

    If exists(Select 1 from table where column = [value])

    Begin

    Exec msdb.dbo.sp_send_dbmail @recipients = [your email], @subject = 'Value Found',

    @Body = 'Value found in table. Please fix'

    End

  • Hey, I like that! Haven't used sp_send_dbmail before and it's worked fine. Thanks.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply