I have the following problem:
I'm running a Procedure in Sql Sever that generates an XML to me via the XML PATH command, however, one of the fields is an array, what I got was this:
This select is inside the PROC which is what matters to generate the XML:
<font face="Courier New" size="2">
<font color = "blue">SELECT</font> <font color = "maroon">order_priority</font> <font color = "maroon">"@ID"</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_number</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_type</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_priority</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_name</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_phone</font><font color = "silver">=</font><font color = "#FF0080"><b>Isnull</b></font><font color = "maroon">(</font><font color = "maroon">order_client_phone</font><font color = "silver">,</font> <font color = "red">''</font><font color = "maroon">)</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_code</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_cpf_cnpj</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_address</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_address_number</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_complement</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_district</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_city</font><font color = "silver">,</font>
<br/> <font color = "fuchsia"><i>Upper</i></font><font color = "maroon">(</font><font color = "maroon">order_client_state</font><font color = "maroon">)</font> <font color = "maroon">order_client_state</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_client_cep</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_exped_name</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_exped_field</font><font color = "silver">=</font><font color = "#FF0080"><b>Isnull</b></font><font color = "maroon">(</font><font color = "maroon">order_exped_field</font><font color = "silver">,</font> <font color = "red">''</font><font color = "maroon">)</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_exped_date</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_erpwms</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_invoices</font><font color = "silver">,</font>
<br/> <font color = "maroon">order_items</font>
<br/><font color = "blue">FROM</font> <font color = "maroon">#temp</font>
<br/><font color = "blue">WHERE</font> <font color = "maroon">order_priority</font> <font color = "silver"><</font> <font color = "black">999</font>
<br/><font color = "blue">ORDER</font> <font color = "blue">BY</font> <font color = "maroon">order_priority</font>
<br/><font color = "blue">FOR</font> <font color = "maroon">xml</font> <font color = "maroon">path</font><font color = "maroon">(</font><font color = "red">'Order'</font><font color = "maroon">)</font><font color = "silver">,</font> <font color = "maroon">root</font><font color = "maroon">(</font><font color = "red">'Customers'</font><font color = "maroon">)</font>
</font>
The result is:
ButwhatIneedwouldbe,wheretheorder_invoicesfieldwouldlooklikethis:
Could someone help me with some tips and hints on how to achieve this result? Thank you in advance!