Microsoft SQL Server database table content can be exported into XML format file with a simple bcp statement.
One way of executing it is from cmdshell as script. The second way is a stored
procedure with xp_cmdshell.
bcp "SELECT FirstName, LastName, Phone, EmailAddress
WHERE LastName LIKE 'A%' ORDER BY LastName, FirstName
FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL "
queryout Contact.txt -c -Sservername -Usa -Ppassword
Examples of Bulk Importing and Exporting XML Documents