SQL从XML中选择XML节点

时间:2014-03-03 14:07:00

标签: sql xml

任何人都可以建议从XML中选择XML节点的语法; assumind以下XML

<DOCUMENT>
  <CLIENT_DETAILS>
     ...more xml
  </CLIENT_DETAILS>
  <USER_DETAILS>
     ...more xml
  </USER_DETAILS>
<DOCUMENT>

SELECT @userDetails = 语法? SELECT @clientDetails = syntax

这样@userDatails最终将包含以下XML

<USER_DETAILS>
  ...more xml
</USER_DETAILS>

@clientDetails将包含

<CLIENT_DETAILS>
   ...more xml
</CLIENT_DETAILS>

1 个答案:

答案 0 :(得分:0)

似乎比预期的要简单

SELECT @userDetails = @ mainXML.query('DOCUMENT / USER_DETAILS');