This is still one of the singlehandedly most useful pieces of code I've run across in years. I have an Extended Events session watching for errors, severity 10 or higher. It logs them. I then use Tom's code below to figure out exactly where the error is. Flawless.

https://straightforwardsql.com/posts/investigating-errors-with-extended-events/ #sqlserver #extendedevents #xevents

Investigating Errors With Extended Events

This is my go-to technique to capture errors which I can debug later.

Xevent question for the group.

I'm trying to collect Extended Events (based on error_reported) from multiple servers, every few minutes. How do I not grab duplicates when I re-grab? Can't use the timestamps, since multi-cores means they could arrive slightly out of order. Event_Sequence, according to Bob Dorr, ascends to bigint, then descends again. So that won't work.

Am I overthinking it? A gigantic "where not exists" seems inelegant. Thanks! #sqlserver #xevents #extendedevents