• Matthew Darwin (7/3/2013)


    Try this:-

    SELECT

    (SELECT custname AS CustName

    , custcode AS CustCode

    FROM @test-2 t1 FOR XML PATH('Item'), TYPE)

    FOR XML PATH('Header'),ROOT('ns1')

    Thanks Matthew Darwin! i see how it is construct.