3
好吧,我有此查詢:SQL服務器的問題 - 查詢到XML
Select Orders.OrderID, ProductID, UnitPrice, Quantity, Orders.OrderDate From [Order Details]
left join Orders on Orders.OrderID=[Order Details].OrderID
where Orders.OrderID='10248' or Orders.OrderID = '10249'
FOR XML Auto, Elements;
,當我執行它提供了以下XML:
<Orders>
<OrderID>10248</OrderID>
<OrderDate>1996-07-04T00:00:00</OrderDate>
<Order_x0020_Details>
<ProductID>11</ProductID>
<UnitPrice>15.4000</UnitPrice>
<Quantity>12</Quantity>
</Order_x0020_Details>
<Order_x0020_Details>
<ProductID>42</ProductID>
<UnitPrice>10.7800</UnitPrice>
<Quantity>10</Quantity>
</Order_x0020_Details>
<Order_x0020_Details>
<ProductID>72</ProductID>
<UnitPrice>38.2800</UnitPrice>
<Quantity>5</Quantity>
</Order_x0020_Details>
</Orders>
<Orders>
<OrderID>10249</OrderID>
<OrderDate>1996-07-05T00:00:00</OrderDate>
<Order_x0020_Details>
<ProductID>14</ProductID>
<UnitPrice>20.4600</UnitPrice>
<Quantity>9</Quantity>
</Order_x0020_Details>
<Order_x0020_Details>
<ProductID>51</ProductID>
<UnitPrice>46.6400</UnitPrice>
<Quantity>40</Quantity>
</Order_x0020_Details>
</Orders>
這是我很好,除了我想" <Order_x0020_Details> "
只讀爲" <Order Details> "
,但我無法弄清楚如何做到這一點。有什麼建議麼?謝謝
我該如何改變這個以包裝所有與 WrapperElement>,以便它符合XML?試圖解析時我會遇到錯誤。謝謝! –
daveomcd
2012-07-16 02:22:45