Home Forums Programming XML Returning Multiple Unrelated Tables in Single XML Output From Stored Proc RE: Returning Multiple Unrelated Tables in Single XML Output From Stored Proc

  • blugecko (10/27/2012)


    Came right with guidance from various sources. Below the solution in case anyone ever wants to do something similar...

    DECLARE @TempExportTable TABLE

    (

    Products XML,

    Colours XML,

    Sizes XML

    )

    INSERT INTO @TempExportTable VALUES

    (

    (SELECT * FROM Products FOR XML AUTO, ELEMENTS),

    (SELECT * FROM Colours FOR XML AUTO, ELEMENTS),

    (SELECT * FROM Sizes FOR XML AUTO, ELEMENTS)

    )

    SELECT

    Products as '*',

    Colours as '*',

    Sizes as '*'

    from @TempExportTable

    FOR XML PATH('ExportList')

    I serached for a solution more than a week. Thank you for your question and answer.:-)