/* By default, SQL SERVER returns the values as attributes. Some times you might need the values as nodes. Use the ELEMENTS keyword for that. */ SELECT OrderNumber, ItemNumber, Qty FROM OrderDetails FOR XML AUTO, TYPE, ELEMENTS /* OUTPUT: 00001 A001 10 00001 A002 20 00001 A003 30 */