Updating XML doc stored in a Text column

  • Hi,

    Although the database I am working on is now running on SQL 2005, there are a number of Text and Varchar columns in which mid-sized XML documents are stored.

    I need to update certain elements within these stored documents, and would like to use some of the SQL2005 XML features to do so - rather than using cumbersome string parsing/replacements. Obviously if the columns were of the XML datatype then it'd be quite straightforward, but what possible workarounds are there for Text datatype columns?

    The basic process I had in mind was:

    1. Retrieve the XML value from the table

    2. Parse the XML, using OPENXML or similar

    3. Update the required elements using XPath

    4. Convert the document back to a string, and update the original table row.

    Any suggestions?

    thanks

    Marcus.

  • Correct me if I'm wrong, but it sure looks like you answered your own question. Have you tried what you proposed and found that it doesn't work as desired?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply