I want to get the lowest value in the hierarchy in a dynamic XML file.
I try to write a dynamic expression for reading from XML file:
patdata.value('(*[local-name() = sql:column("DataMng.Root")]/*[local-name() = sql:column("textMng.FieldId")]/text())[1]', 'nvarchar(max)')
DataMng.Root= ‘rc0036’
FieldId=’s4356/L4356/F4357′
but I am getting **NULL **although there is value on this XML file.
When I write the following expression, I get the output I want:
**patdata.value(‘(*[local-name() = sql:column(“DataMng.Root”)]/s4356/L4356/F4357/text())[1]’, ‘nvarchar(max)’)
**
1