June 26, 2019 at 9:53 pm
I have table which has startdate which captures data every hour
I need to get alert if startdate data didn't capture data more than 2 hour.
How should I right query and send alert if data didn't receive more than 2 hours
June 27, 2019 at 12:57 am
Write a stored procedure and schedule it to run every hour that checks the latest STARTDATE in your table. If the number of hours difference is greater than or equal to 2, then send yourself an email from within the stored procedure by executing msdb.dbo.sp_send_dbmail.
if 2 <= (select DATEDIFF(HOUR, MAX(STARTDATE), GETDATE()) from {your-table})
exec msdb.dbo.sp_send_dbmail .....
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply