XPath to fetch SQL XML value

后端 未结 3 1000
星月不相逢
星月不相逢 2020-12-04 22:25

Here is my problem: from the following XML that is within a column, I want to know if the value of a variable with the name \'Enabled\' is equal to \'Yes\' given a step Id a

3条回答
  •  天涯浪人
    2020-12-04 22:50

    I think the xpath query you want goes something like this:

    /xml/box[@stepId="$stepId"]/components/component[@id="$componentId"]/variables/variable[@nom="Enabled" and @valeur="Yes"]
    

    This should get you the variables that are named "Enabled" with a value of "Yes" for the specified $stepId and $componentId. This is assuming that your xml starts with an tag like you show, and not

    If the SQL Server 2005 XPath stuff is pretty straightforward (I've never used it), then the above query should work. Otherwise, someone else may have to help you with that.

提交回复
热议问题