I want to remove the attribute xsi:nil "true" for GeographicalLimit tag and I need to enter some dummy text for the same using SQL
Current XML:
<Header>
<SampleTag>text</SampleTag>
<GeographicalLimit xsi:nil="true" />
<SampleTag> text </SampleTag>
</Header>
I need to change it to this XML:
<Header>
<SampleTag>text</SampleTag>
<GeographicalLimit>Sample text</GeographicalLimit>
<SampleTag> text </SampleTag>
</Header>
I want to achieve the reverse of this Replace XML node to empty and add xsi:nil through SQL
I am assuming that you are using MS SQL Server.
First, your XML sample is not well-formed because there is no namespace declaration with the xsi prefix. So, we need to fix it by adding such namespace declaration to the root.
The rest is a two step process:
SQL
Final Output