/* You will notice that the result does not have a ROOT element. A corret XML document/fragment should always have a ROOT element. Let us have this added by using the ROOT keyword. */ SELECT OrderNumber, ItemNumber, Qty FROM OrderDetails FOR XML AUTO, TYPE, ELEMENTS, ROOT /* OUTPUT: 00001 A001 10 00001 A002 20 00001 A003 30 */