如何更正以下查询以返回xml。 我收到以下错误“第14行:'根'附近的语法错误。 “如何解决这个问题?
declare @v_CurrentDate datetime
set @v_CurrentDate = '2016-07-28'
if exists (select 1
from mydb.dbo.Orders
where OrderDate = @v_CurrentDate)
begin
SELECT 'mydb' AS Client, PrimaryKey, Ship_Status, OrderDate, ApprovedDate, AcknowledgeDate, ShipToSiteName, AntShipDate
FROM mydb.dbo.Orders
WHERE (Ship_Status = 'Acknowledged')
ORDER BY PrimaryKey DESC
for xml auto, type, elements, Root('Orders')
end
else
select cast('<NoRecords>No order records available for this date.</NoRecords>' as xml)