declare @T table ( ErrorXML xml ); insert into @T values...


Please login or register to vote for this query.

(click on this box to dismiss)

Space Exploration

Q&A for spacecraft operators, scientists, engineers, and enthusiasts

declare @T table
  ErrorXML xml

insert into @T values
  <Error PropertyName="CaseDisplayID">
    <ErrorMessage Type="Database">Claim is not in awaiting reprice response state. Current case state is ** Closed (Cancelled) **</ErrorMessage>
('<Data><Error PropertyName="CaseDisplayID" /></Data>'),
('<Data />')

select T.ErrorXML.value('(/Data/Error/@PropertyName)[1]', 'nvarchar(50)') as PropertyName,
       T.ErrorXML.value('(/Data/Error/ErrorMessage/@Type)[1]', 'nvarchar(50)') as ErrorType,
       T.ErrorXML.value('(/Data/Error/ErrorMessage)[1]', 'nvarchar(max)') as ErrorMessage
from @T as T
where T.ErrorXML.exist('/Data/Error') = 1

Enter Parameters

Switch to meta site
loading Hold tight while we fetch your results