2

I'd like to track which procedures are failing in my database using extended events. Procedures are being executed like that from an application:

EXEC sp_executesql 'exec dbo.GetData';

And when that fails, I expect to capture XE event of rpc_completed with result = 1 (failure) but it comes with result = 0

My procedures look like that:

CREATE PROCEDURE dbo.GetData
BEGIN
    SET NOCOUNT ON;
    BEGIN TRY
        SELECT 1/0 AS DivisionByZero;
    END TRY
    BEGIN CATCH
        EXECUTE dbo.LogError;
        THROW;
    END CATCH
END

Is there some sort of configuration that needs to happen to track failed rpc_completed events or I do something wrong?

2
  • Did you try capturing the exception event and then can match up the two events via the SPID?
    – Tara Kizer
    Commented Jan 19, 2017 at 17:56
  • That's what i actually do. I capture both of these and try to merge into one. But I don't want to capture every single rpc completed, that's the reason I filter by result=1 which is supposed to mean failure Commented Jan 19, 2017 at 18:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.