• Bill.Smith (4/29/2013)


    Any suggestion on how to create XML like this from SQL Server?

    I was able to create the XML without the Metadata lines using, "FOR XML RAW ('Request'), ELEMENTS".

    <Request>

    <RequestType>NEW</RequestType>

    <CompanyName>Main St. Bistro</CompanyName>

    <CompanyID>1234567890</MerchantID>

    <Country>US</Country>

    <PostalCode>60602</PostalCode>

    <Metadata name="PROGRAM" global="true">A</Metadata>

    <Metadata name="LEVEL" global="true">2</Metadata>

    <Metadata name=”PROMOTION”>HAPPYMEAL</Metadata>

    </Request>

    Perhaps the examples in this post will help give you some ideas:

    SQL to XML Examples