Duplicate: this exact question was asked by the same author in How do I update a XML string in an ntext column in SQL Server? . Please close this one and answer in the original question.
I have a SQL table with 2 columns. ID(int) and Value(ntext)
The value rows have all sorts of xml strings in them.
ID Value
-- ------------------
1 <ROOT><Type current="TypeA"/></ROOT>
2 <XML><Name current="MyName"/><XML>
3 <TYPE><Colour current="Yellow"/><TYPE>
4 <TYPE><Colour current="Yellow" Size="Large"/><TYPE>
5 <TYPE><Colour current="Blue" Size="Large"/><TYPE>
6 <XML><Name current="Yellow"/><XML>
How do I:
A. List the rows where <TYPE><Colour current="Yellow",
bearing in mind that there is an entry
<XML><Name current="Yellow"/><XML>
B. Modify the rows that contain
<TYPE><Colour current="Yellow" to be
<TYPE><Colour current="Purple"
Thanks! 4 your help
您将必须使用UPDATETEXT,TEXTPTR和PATINDEX, 本文提供了一个不错的SearchAndReplace存储过程。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.