sql - querying using two attributes in xml column -


i have seen examples querying using single attribute puzzled on how use 2 attributes.

<componentcache>   <component name="calc_todaydatelong" value="monday, may 06, 2013" />   <component name="calc_officename" value="default office" />   <component name="staffinfo_fullname" value="lee lee, jr" />   <component name="patinfo_fullname" value="jayne h doe" />   <component name="patinfo_birthdate" value="11/07/1901" />   <component name="patinfo_patientno" value="ag000003" />     <component name="encount_dxdesc1" value="abc" />   <component name="encount_dxdesc2" value="def" />   <component name="encount_dxdesc3" value="hijk" /> </componentcache>  select documentstoreid, doctemplateid, personid, document documentstore datacache.value('/componentcache/component... 

i want select row(s) name "encount_dxdesc%" , value = 'def'

here's method using xquery:

select documentstoreid, doctemplateid, personid, document documentstore datacache.exist('/componentcache/component[contains(@name, "encount_dxdesc")][@value="def"]')=1 

this return rows in table contain xml document node has name attribute containing "encount_dxdesc" , value attribute of "def"


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -