Updating XML stored in a column via update text function????

  • Hey Gurus and Grand Masters 😎

    I have xml stored in a column with data type = text. I need to update multiple substrings of data within that text column (ie update β€˜<data>1</data>’ to β€˜<data>Test</data>’, β€˜<data>2</data>’ to β€˜<data>Test2</data>’). In trying the Replace function, it returns this message: Argument data type text is invalid for argument 1 of replace function.

    In light of this, I am using the updatetext function instead. Due to the column data type of text, this function requires a delete_lengthvalue in bytes. Right now I have string length, I am looking for the best way to calculate byte length. Is there a built-in function to do this? Multiplying by a factor seems to work in some cases but not all, I am still in the midst of testing this…

  • LutzM (8/27/2010)


    Duplicate post.

    Discussion started here.

    As a side note: I don't want to start a race between you reposting your question and me adding the above reply. So please stop opening new threads with the very same issue. Thank you.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Sorry, I'm new to SqlServerCentral and am still getting the hang of things. I put my post in a topic and saw I put it under the wrong topic. I'll keep this in mind.

  • No big deal. I just wanted to stop it before becoming a habit... πŸ˜‰

    Did you see my subject-related reply on one of your threads?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I did see it, Thanks!!! I am trying to implement it now. I completely forgot about XQueries. Thanks for the refresher and the link. I'm feeling confident that this should work πŸ˜€

Viewing 5 posts - 1 through 4 (of 4 total)

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