I have a XML column that is not generated with a namespace, meaning no xmlns attribute. Unfortunately, I cannot fix the actual problem, meaning where the XML is created.
For example:
<root>Our Content</root>
I can modify the XML data before it's returned to a particular client that expects a namespace. What I want is pretty simple:
<root xmlns="http://OurNamespace">Our Content</root>
I tried something like:
.modify('insert attribute xmlns {"ournamespace"}...
But that errors with
Cannot use 'xmlns' in the name expression.
My questions are:
- Is there a technique around this particular error?
- Is there an alternative or better way to add/change a namespace on a SQL XML type?
This is in a SQL Server 2012 stored procedure.