Updating Value of a particular XML node in a col where data type is xml

  • We have a table 'A' and its has a col 'A' with data type xml.

    The contents are in xml form and I need to directly update one node in that xml.

    update from 'B' Set Name=Lower(Name); -- will update all names in that table to lower case

    Same way there is a node 'Name' in the xml which is stored in 'colA' in one statement. We have done in a different way. I need to know can be done the say I have mentioned above in one simple statement?

    cheers

    Siddarth

  • XML is not my strong point, but if you provide more details regarding your data and table structure maybe we cud try.

    "Keep Trying"

  • I am trying to paste the xml content here but the site is now allowing me to do so.

  • Yeah, I tried to give you an example but I also could not past xml content here.

    But as a clue, lookup the SQL Server documentation: there are examples how to modify xml data types using XQuery syntax.

  • siddartha pal (10/30/2008)


    I am trying to paste the xml content here but the site is now allowing me to do so.

    Save the XML as a txt file and upload it to the site.

    Then we can copy it and use it 🙂

  • See if this works

    although I don't see the point of LowerCase 1 XML element (either do it in front-end), or might as well LowerCase the entire XML

    UPDATE TABLE

    SET XMLcolumn.modify(

    'replace value of (//WebSRFTemplate/Data/ACCESSAEndSiteID/text()) [1] with "Test"')

    WHERE condition

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • I have done in some other way and was looking for something like the same. I will execute the same and check if the same works. Some one told me that you cant modify any xml column the way you can fire update on any other column.

    thanks a lot for the same and I will get back to you with the result.

    cheers

    Siddarth

Viewing 7 posts - 1 through 6 (of 6 total)

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