Update and/or insert element into xml column

mich

New Member
I'm trying to write an update statement that checks if an element exists in an XML column, and updating it's value if it exists. If not it will then insert the value as a new element.Something like:\[code\]UPDATE TableSET xmlCol = casewhen xmlCol.exist('element') = 1then xmlCol.modify('replace value of blah')else xmlCol.modify('insert blah')endwhere whatever\[/code\]Am I going about this the wrong way?
 
Back
Top