My question is similar to this one: http://stackoverflow.com/questions/3061804/choose-a-xml-node-in-sql-server-based-on-max-value-of-a-child-element except that my column is NOT of type XML, it's of type nvarchar(max).
I want to extract the XML node values from a column that looks like this:
<Data>
<el1>1234</el1>
<el2>Something</el2>
</Data>
How can I extract the values '1234' and 'Something' ?
doing a convert and using the col.nodes is not working. CONVERT(XML, table1.col1).value('(/Data/el1)[1]','int') as 'xcol1',
After that, I would like to do a compare value of el1 (1234) with another column, and update update el1 as is. Right now I'm trying to just rebuild the XML when passing the update: ie
Update table set col1 ='<Data><el1>'+@col2+'</el1><el2>???</el2>