Modify existing records
Is there any way to update the value of each node in xml file like this:
<RootNode>
<Item>test1</Item>
<Item开发者_StackOverflow>test2</Item>
<Item>test3</Item>
</RootNode>
that is actually xml column in table to the following:
<RootNode>
<Item><![CDATA[test1]]></Item>
<Item><![CDATA[test2]]></Item>
<Item><![CDATA[test3]]></Item>
</RootNode>
There is an XML way, but it might be easier to convert the XML field to varchar and then:
@var = replace(@var,'<item>','<item><![CDATA[')
and then
@var = replace(@var,'</Item>',']]></Item>')
both of which could be performed in one statement, but it would depend on the rest of the XML data, how much data you're wanting to update and the resources available etc.
精彩评论