开发者

Modify existing records

开发者 https://www.devze.com 2023-04-12 23:07 出处:网络
Is there any way to update the value of each node in xml file like this: <RootNode> <Item>test1</Item>

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

精彩评论

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