I am perplexed. After lots of searching, reading, mimicking the examples, I still have not successfully achieved the results.
My query is simple: SELECT ProductLineCode, Description FROM tblProduct ORDER BY sortid FOR XML AUTO, ELEMENTS
When the XML comes back, it has multiple root level elements. I am at a loss as to why and how to fix it. I would greatly appreciate any help.
It is SQL 2000 SP 4.
In addition, if anyone has any advice as to the next task I have: In a Windows Form app, there is a button that our network guy will press to synch current data in our SQL Server to an XML file and download it to a specific directory on a laptop computer.
The higher priority though is trying to get the query above to not give me the multiple root level elements.
Thank you in advance!
asked Feb 10 '10 at 12:41 PM in Default
I think that is expected behaviour - FOR XML does return data with multiple top level elements. When I render out XML result sets in my apps, I always add a 'resultSet' root node which wraps the returned content.
answered Feb 10 '10 at 01:18 PM
Matt Whitfield ♦♦