This issue was posted recently, but I couldn't use the solution. I am
having the same problem in that the XML returned by SQL2000 as a .NET
XmlReader can't get loaded into an XmlDocument object because is has no
single root. Here is a sample query:
SELECT 1 AS Tag,
NULL AS Parent,
Orders.OrderID AS [Orders!1!OrderID],
NULL AS [OrderDetails!2!ProductID]
FROM Orders
UNION ALL
SELECT 2,
1,
Orders.OrderID,
[Order Details].ProductID
FROM Orders, [Order Details]
WHERE Orders.OrderID = [Order Details].OrderID
ORDER BY [Orders!1!OrderID], [OrderDetails!2!ProductID]
FOR XML EXPLICIT
The question is: What do I need to add to this query to get a single root
element (say, <Root>[Results]</Root>)? Alternatively, is there an easy way
to establish a root element in mhy XmlDocument object before loading the
results from the XmlReader? Thanks very much. Any help is appreciated.
- Erik Johnson