考虑下表:
订单
OrderId Date CustomerId
1000 2012-06-05 20:03:12.000 51
1001 2012-06-16 12:02:31.170 48
1002 2012-06-18 19:45:16.000 33
当我使用 FOR XML 提取订单数据时:
SELECT
OrderId AS 'Order/@Order-Id',
Date AS 'Order/ShipDate',
CustomerId AS 'Order/Customer'
FROM Orders
WHERE OrderId = 1000
FOR XML PATH ('')
我得到以下结果:
<Order Order-Id="1000">
<ShipDate>2010-02-20T16:03:12</ShipDate>
<Customer>51</Customer>
</Order>
问题是,ShipDate
XML 文件中的值需要采用M/DD/YYYY H:mm:ss PM
. 如何ShipDate
将 XML 文件中的输出更改为所需的格式?
任何帮助将不胜感激!