Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Aliasing a FOR XML PATH result RE: Aliasing a FOR XML PATH result
rob_dalzell
Old Hand
Points: 315
More actions
January 17, 2013 at 6:07 am
#1578271
/* If you're using SQL2005+ you could try something this */
;
WITH CTE ( Test )
AS ( SELECT Names
FROM @test-2 t
FOR XML PATH('Test')
)
SELECT Test ,
CAST(Test AS XML) AS Test
FROM CTE