declare @xml xml
set @xml='<root>
<note ID="egu" Name="256">
<item ID="b1" Name="511">
<items ID="be2" Name="子门" />
</item>
<item ID="b2" Name="2154">
<items ID="be3" Name="子门3" />
<items ID="be4" Name="子门4" />
</item>
<item ID="b3" Name="5401">
<items ID="be3" Name="子门3" />
<items ID="be4" Name="子门4" />
</item>
<item ID="bf5" Name="68955">
<items ID="be3" Name="子门3" />
<items ID="be4" Name="子门4" />
</item>
<item ID="bgt4" Name="87456">
<items ID="be3" Name="子门3" />
<items ID="be4" Name="子门4" />
</item>
</note>
</root>'
select @xml.query('//item[@ID="b1" or @ID="b3" or @ID="bgt4"]')//对属性ID的筛选
sql对xml的多条件查询
最新推荐文章于 2024-06-26 22:23:24 发布