This page contains references to a collection of short articles I have written on generating XML output using TSQL directive FOR XML. FOR XML can be used with AUTO, RAW, PATH or EXPLICIT to generate XML results with the desired structure.
This article shows several examples that generate XML output using FOR XML along with AUTO and RAW.
Explains the PATH directive and shows a few examples using FOR XML with PATH to generate XML output using TSQL.
Explains the EXPLICIT directive and shows several examples that generates XML output using FOR XML with EXPLICIT.
A lab that generates an XML tree (hierarchy) using FOR XML EXPLICIT.
Another lab that shows a few XML shaping examples using FOR XML PATH and FOR XML EXPLICIT
A lab that generates an RSS 2.0 feed using TSQL keyword FOR XML with PATH (SQL Server 2005)
Contact me for comments/suggestions/feedback.