4

I'm trying to use extended events to track queries that never complete using Event Pairing as a target. (see this question I asked a few days ago). The event pairing target should let me find queries that started but never completed.

My new problem is that I need to know what else was happening on the server when this event happens. I'd like to execute a stored procedure like sp_who, sp_who2, sp_WhoIsActive, etc. whenever I find a query that has not completed in 20+ seconds, for example. Is this possible?

8

Out of the box, no.

You'd need to hook into the event stream for extended events and then take action based on that. Tom Stringer has a good overview and sample code to do this!

See also Introducing the Extended Events Reader by Mike Wachal.

Jonathan Kehayias also describes it in detail in his Pluralsight course.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.