Home Forums SQL Server 2008 T-SQL (SS2K8) Problem using FOR XML in SQL Query RE: Problem using FOR XML in SQL Query
spungus
SSC-Addicted
Points: 443
More actions
July 3, 2013 at 7:11 pm
#1629714
Matthew Darwin (7/3/2013)Try this:-SELECT(SELECT custname AS CustName, custcode AS CustCodeFROM @test-2 t1 FOR XML PATH('Item'), TYPE)FOR XML PATH('Header'),ROOT('ns1')
Matthew Darwin (7/3/2013)
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.