Quantcast
Channel: SQL Service Broker forum
Viewing all articles
Browse latest Browse all 461

Extracing SQL Service Broker Error Fields

$
0
0

I am creating some error handling for the `'SQL/ServiceBroker/Error'` `MessageType` within my queues `Activation Stored Procedure`.  While, I have information on how to access the following exception fields:

 - Code (e.g. Error Number)
 - Description (e.g. Error Message)

I am having trouble finding information on how to access (other) 'standard' error fields from the 'SQL/ServiceBroker/Error' schema, fields like:

DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
DECLARE @ErrorProcedure VARCHAR(400);
DECLARE @ErrorLine INT;

...I am having trouble finding information on.

Does anyone know...

 - Where I can get information of the access these fields from the
   'SQL/ServiceBroker/Error' schema?

FOR EXAMPLE:
For those who need to see code ...

    ---------------
    -- HANDLE ERRORS: for Error MessageTypes
    ---------------
    ELSE IF @MessageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
    BEGIN

           -- GET ERROR: Alias Namespace
           WITH XMLNAMESPACES ('http://schemas.microsoft.com/SQL/ServiceBroker/Error' AS ssb)
           SELECT 
                     @ErrorNumber = @MessageBody.value('(//ssb:Error/ssb:Code)[1]', 'INT'),
                     @ErrorMessage = @MessageBody.value('(//ssb:Error/ssb:Description)[1]',               'NVARCHAR(MAX)');
                     --@ErrorSeverity = ????,
                     --@ErrorState = ????,
                     --@ErrorProcedure = ????,
                     --@ErrorLine = ????;


        -- CLOSE CONVERSATION
        END CONVERSATION @ConversationHandle;
    END

                                                             





Viewing all articles
Browse latest Browse all 461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>