简单来说,我只是想查询XML列(下面):
只对旁边有两个星号的行感兴趣
-falsefalse * 真正* 假* 真正** 假** 假 假 假 假 假 假 假 假 假 假 假 假 假
答案 0 :(得分:0)
试试这个,如果不行,那么解释你的标准
Declare @i xml='<?xml version="1.0"?>-<ArrayOfBoolean xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><boolean>false</boolean><boolean>false</boolean>
<boolean>true</boolean><boolean>false</boolean><boolean>true</boolean><boolean>false</boolean><boolean>false</boolean><boolean>false</boolean>
<boolean>false</boolean><boolean>false</boolean><boolean>false</boolean><boolean>false</boolean><boolean>false</boolean><boolean>false</boolean>
<boolean>false</boolean><boolean>false</boolean><boolean>false</boolean><boolean>false</boolean><boolean>false</boolean></ArrayOfBoolean>'
;with cte as
(select *,ROW_NUMBER()over(order by (SELECT 0))rn from
(SELECT col1 = col1.value('.', 'bit')
FROM
@i.nodes('/ArrayOfBoolean/boolean') AS tag ( col1 ))tbl
)
select * from cte where rn>(select max(rn)+1 from cte where col1=1)