I’ve got a few thousand rows stored as xml in a varchar column, and I need to add a new node to each of them. I’ve read that there is no update mechanism and pretty much the only way I can do this is to read out the rows, update them locally, then write them back in.
If this were a small number of rows I’d do it manually, but I can’t go through several thousand of them or my brain will melt (I don’t want that).
Are there any external tools that could help or even just good techniques for doing updates of this kind/volume?
I’m not 100% sure if we’ve got an xsd defined but I imagine we do (I can create one, in any case).
Clarification: I did not design the table and it’s unlikely I’ll be able to change it to an actual xml type column
My suggestion would be:
add a new column of type
XMLto your tablefill that column with the values from that other column
in your XML column, add that tag you need
if you really need it, update the
varcharcolumn from the XML column again (but WHY is itvarcharin the first place, when it really contains XML????)