How do I search a NTEXT column for XML attributes and update the values? MS SQL 2005

Posted by Alan on Stack Overflow See other posts from Stack Overflow or by Alan
Published on 2009-08-04T14:42:21Z Indexed on 2010/06/07 15:02 UTC
Read the original article Hit count: 280

Filed under:
|
|

Duplicate: this exact question was asked by the same author in http://stackoverflow.com/questions/1221583/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

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2005