2

ContentNodeコンマを含むすべてのノードについて、次の XML をクエリしようとしています。

<Node xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xxx.xxx.xxx">
  <SubNode>
    <SubSubNode>
      <ContentNode>Data, </ContentNode>

以下は 0 件の結果を返します。

select * from Table where [XML].exist('/Node/SubNode/SubSubNode [contains(ContentNode[1],",")]')=1

どんな助けでも大歓迎です。

4

1 に答える 1

1

デフォルトの名前空間があり、それをクエリで使用する必要があります。WITH XMLNAMESPACES (Transact-SQL) をご覧
ください。

with xmlnamespaces(default 'http://schemas.xxx.xxx.xxx')
select *
from Table
where [XML].exist('/Node/SubNode/SubSubNode [contains(ContentNode[1],",")]')=1
于 2012-08-24T06:15:00.477 に答える