ExtractValue : How to retrieve a particular value from an XML tag in SQL table, with a key value that can be retrieved from another table

79 views Asked by At

In the below SQL,

SELECT a.No, a.Group, b.Code,  
COALESCE(ExtractValue(a.attributes,'/Attributes/Map/entry[@key="ABC"]/@value’), "N/A") as value 
from report as a  join codevalue as b on a.No = b.No

for the value column, I'm passing the value of ABC to the key to retrieve the values from XML. How can I pass an SQL to the key instead of ABC and the return value from SQL will be the key.

0

There are 0 answers