I\'m trying to select from XML that has a null as one of the attributes. Instead of returning a null, it returns a 0. What am I doing wrong?
See code below to replicate:>
In my case, I am using data type boolean so all the answer here doesn't apply to me. If you are using boolean data type, you can try this one:
myXML.value('Property1[1] cast as xs:boolean?','BIT') AS Property1,
I added this code:
cast as xs:boolean?','BIT'
Which cast if the boolean is null, if it is, it will return null, or else it will return 1 or 0.