Can anyone explain to me the results of this query:
declare @xml xml;
set @xml = '<node attribute="true">Val</node>';
select
T.c.query('xs:boolean(@attribute[1])') Value,
T.c.query('xs:boolean(@attribute[1]) = false') ValueEqualsFalse,
T.c.query('xs:boolean(@attribute[1]) = true') ValueEqualsTrue,
T.c.query('xs:boolean(@attribute[1]) != false') ValueNotEqualsFalse,
T.c.query('xs:boolean(@attribute[1]) != true') ValueNotEqualsTrue
from @Xml.nodes('node') T(c);
The first column, Value, returns true. The rest all return false. So having managed to cast the value to the correct type, how do I actually check it's value?