Azure Synapse pipeline parse xml data to rowset
Hello,
I have source a table where one column has xml data stored in the column as text (nvarchar(max)).
I need parse this xml from every row in the set of columns and rows and load into Azure Synapse SQL dedicated pool. xml functions don't apply here because Azure synapse does not support xml.
Table is something like this:
----------------------------------------------------------------------------------------------
studentId studentName requests
----------------------------------------------------------------------------------------------
1 xxx <Customers>
<row>
<CUSTOMERNO>100</CUSTOMERNO>
<OPERATION>INSERT</OPERATION>
<EMAIL>bill.gates@microsoft.com</EMAIL>
</row>
</Customers>
2 yyy <Customers>
<row>
<CUSTOMERNO>101</CUSTOMERNO>
<OPERATION>INSERT</OPERATION>
<EMAIL>top.dates@Muhammad Nabil .com</EMAIL>
</row>
</Customers>
3 xyz <Customers>
<row>
<CUSTOMERNO>120</CUSTOMERNO>
<OPERATION>INSERT</OPERATION>
<EMAIL>bill.gates@microsoft.com</EMAIL>
</row>
<row>
<CUSTOMERNO>121</CUSTOMERNO>
<OPERATION>DELETE</OPERATION>
<EMAIL>******@xyztool.org</EMAIL>
</row>
<row>
<CUSTOMERNO>122</CUSTOMERNO>
<OPERATION>UPDATE</OPERATION>
<EMAIL>steve.jobs@apple .com</EMAIL>
</row>
</Customers>
----------------------------------------------------------------------------------------------
I tried to use data flow Parse transformation, but for the third row it returns only last element (where CUSTOMERNO is 122). But I need such result table:
----------------------------------------------------------------------------------------------
studentId studentName CUSTOMERNO OPERATION EMAIL
----------------------------------------------------------------------------------------------
1 xxx 100 INSERT bill.gates@microsoft.com
2 yyy 101 INSERT top.dates@Muhammad Nabil .com
3 xyz 120 INSERT bill.gates@microsoft.com
3 xyz 121 DELETE ******@xyztool.org
3 xyz 122 UPDATE steve.jobs@apple .com
----------------------------------------------------------------------------------------------
or such:
----------------------------------------------------------------------------------------------
CUSTOMERNO OPERATION EMAIL
----------------------------------------------------------------------------------------------
100 INSERT bill.gates@microsoft.com
101 INSERT top.dates@Muhammad Nabil .com
120 INSERT bill.gates@microsoft.com
121 DELETE ******@xyztool.org
122 UPDATE steve.jobs@apple .com
----------------------------------------------------------------------------------------------
Please could someone tell me how to parse the xml text into a set of strings?
Thanks in advance.