SQLTeam.com | Weblogs | Forums

Using attribute value to select xml block


#1

Hi, in the below example, I need to fetch <Name> value for which the EcinRecordID=1042893. Please let me know how to achieve this. is the below statement correct?

/Findings/Finding/@EcinRecordID=1042893/Name/text()

   <Finding EcinRecordID="1042893">
      <Name>Goal Length of Stay for the ORG</Name>
      <Selected Value="0" DisplayValue="No"/>
   </Finding>
   <Finding EcinRecordID="1042894">
      <Name>Goal Length of Stay for the GRG</Name>
      <Selected Value="1" DisplayValue="Yes"/>
      <NoteText>3 days</NoteText>
   </Finding>
</Findings>```

#2

Duplicate - re-posted here:

/t/using-attribute-value-to-select-xml-block/10342


#3

#4

Locked. Please see the other thread.