开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜