XQuery modify help

  • Hi,

    Thanks for your help in advance.

    I am trying to edit some xml

    <resRefDate>

    <refDate>20121218</refDate>

    <refDateType>

    <DateTypCd value="001" />

    </refDateType>

    </resRefDate>

    <resRefDate>

    <refDate>19820116</refDate>

    <refDateType>

    <DateTypCd value="002" />

    </refDateType>

    </resRefDate>

    UPDATE dbo._SSA SET xml_data.modify('replace value of (/metadata/dataIdInfo/idCitation/resRefDate/refDate/text())[1] with xs:string(sql:variable("@dTxtPubdate")) ') WHERE ID= @CustID

    UPDATE dbo._SSA SET xml_data.modify('replace value of (/metadata/dataIdInfo/idCitation/resRefDate/refDate/text())[2] with xs:string(sql:variable("@dTxtPubdate")) ') WHERE ID= @CustID

    At the moment the first refDate updates correctly but not the second. Could you please help with how I need to alter the modify so that I can change the values for both nodes.

    Many Thanks,

    Oliver

  • I forgot to say that the node is preceeded by

    /metadata/dataIdInfo/idCitation/

    Many Thanks,

    Oliver

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply