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:>
I would sugest this approach:
DECLARE @a XML = '
1
1
2
3
3
'
SELECT
ParamValues.TaskChainerTask
.value('./Property1[not(./@*[local-name()="nil"] = "true")][1]', 'int') as Property1,
ParamValues.TaskChainerTask
.value('./Property2[not(./@*[local-name()="nil"] = "true")][1]', 'int') as Property2
FROM @a.nodes('//Element') ParamValues(TaskChainerTask)