Alert for slow running query on SQL server -


I would like to create a SQL job that runs a query and if I take a certain amount of time to send one Email alert is any information about how to do this. I'm running SQL Server 2008.

To measure the run time of a specific query, you can just capture it from the job Increase an event within itself and then either an agent to trigger a failure warning or send an email to T-SQL using DBM:

  declare @Elapsed int, @ Start datetime = getdate); - Wait for your question to wait '00: 00: 03 '- @Elapsed = datediff (ss, @start, getdate ()); Raiserror (ran for query '% d second (s)', 10, 1, @Ellepeded) with now;   

The outcome of this approach requires you to actually complete the query in order to measure the runtime

Comments