0

Does anyone has a T-SQL query which checks the stored procedure run duration and inform DBA team if it run long may be more than 1 min.

Any help would be appreciated

Thanks

  • The first part ( detecting the long running SP ) could be accomplished by using Extended Events or SQL Profiler. Of course you can create a job in SQL Server Agent that will check your system and send an e-mail. The job should be scheduled. – Darko Martinovic Oct 17 at 19:22
  • 2
  • 1
    You could have the SP add a row with a timestamp to a table when it starts, and then delete that row when it's finished. Then you would need another process running that checks every second to see if there are any timestamps in the table that are more than one minute old. If there is, raise an error, and set up an alert for that error. – Tony Hinkle Oct 18 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.