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 @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
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