开发者

Textual find and replace within an XML column

开发者 https://www.devze.com 2023-01-09 10:08 出处:网络
I\'m trying to find and replace all instances of \'this phrase\' with开发者_如何学C \'that phrase\' in an xml type column using T-SQL.

I'm trying to find and replace all instances of 'this phrase' with开发者_如何学C 'that phrase' in an xml type column using T-SQL.

The xml column contains fields that are more than 8000 characters long.

I tried using the Replace function but it doesn't like the XML data type, and the data can't be squeezed into a varchar.


Whatever size it is, it can be put in a varchar(max) (a datatype new with 2005), which supports all the text-manipulation functions.


I've never done it myself, but it looks like this article should help. It looks like you'll do an Update statement like:

UPDATE [Table]
SET Document.Modify('[namespace declaration];
    Replace Value Of [Xpath expression] with [New Value]')

But I would definately read that article carefully- just skimming it, I may have missed something.

0

精彩评论

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