I have the following XML string:
<row>
<id>
<old></old>
<new>2151</new>
</id>
<name>
<old></old>
<new>test</new>
</name>
<amount>
<old></old>
<new>62</new>
</amount>
</row>
I need to parse and replace the string so that the end result will have the format:
columnname|oldvalue|newvalue^
Therefore the above example would look like this:
id||2151^name||test^amount||62^
The XML string will always contain one row
node. The nodes within it (ig. id, name, amount, etc) will vary and it can range for a couple of nodes to over 100 nodes. The structure will however be always the same.
Is is possible to do it in SQL server directly or do I need to use a CLR function in order to use regular expressions?
The function must be generic because the column names will be different.