how to get with out erroe in XML

  • HI

    SELECT ProductModelID, Name

    FROM Production.ProductModel

    WHERE ProductModelID=122

    or ProductModelID=119

    FOR XML RAW

    O/P:

    <row ProductModelID="119" Name="Bike Wash"/><row ProductModelID="122" Name="All-Purpose Bike Stand"/>

    If i save this in XML and Run it is getting error(XML document cannot contain multiple root level elements ) why?, how to get this without error i need to save this in XML and run

    Which modes(RAW,AUTO,EXPLICIT,PATH) can be better

    Thanks
    Parthi

  • Hi

    You have to specify a ROOT element:

    SELECT ProductModelID, Name

    FROM Production.ProductModel

    WHERE ProductModelID=122

    or ProductModelID=119

    FOR XML RAW, ROOT('MyRoot')

    Greets

    Flo

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply