I want to replace plus symbol with underscore in the one xml node of a particular table.
Example: In the below input, i want to replace plus symbol only in filepath node and NOT filename node.
Table column data type is XML and NOT varchar.
Input:
<mediadata>
<image>
<FileName>BUF2011-450</FileName>
<FilePath>/uploadedImages/Products/Indoor_Fun/Puzzles___Brain_Teasers/Puzzles/2000+_Pieces/BUF2011-450.jpg</FilePath>
<Thumbnails>
<Thumbnail>
<FileName>BUF2011-450</FileName>
<FilePath>/uploadedImages/Products/Indoor_Fun/Puzzles___Brain_Teasers/Puzzles/2000+_Pieces/thumb_BUF2011-450_Large.jpg</FilePath>
</Thumbnail>
<Thumbnail>
<FileName>BUF2011-450</FileName>
<FilePath>/uploadedImages/Products/Indoor_Fun/Puzzles___Brain_Teasers/Puzzles/2000+_Pieces/thumb_BUF2011-450_Small.jpg</FilePath>
</Thumbnail>
</Thumbnails>
</image>
</mediadata>
Edit
The table variable
@Tabove is instead of your table. Assume that your table is namedYourTableand you have oneIDcolumn andXMLColcolumn. The update statement could look like this to change the XML whereIDis 1.Edit
It is not possible to update more than one node at a time with
.modify(). You have to do this in a loop. The script below uses@Tas a test table. You should replace that with whatever your table is called.@Thas anIDcolumn and the script assumes that you only update one row at a time and that you know the ID for that row. There are some comments in the code that explains what I do. Don’t hesitate to ask if there are something I should make clearer.