In SQL Server 2000, RAW mode FOR XML queries can return only attribute-centric XML. In SQL Server 2005, you can use the ELEMENTS directive with RAW mode queries to return element-centric XML. The following example shows how to use the ELEMENTS directive with RAW mode.
When element-centric XML is returned in SQL Server 2000, null columns are omitted in the results. In SQL Server 2005, you can specify that null columns should yield empty elements with the xsi:nil attribute by using the XSINIL option with the ELEMENTS directive in AUTO, RAW, and PATH mode queries or by using the elementxsinil column mode in EXPLICIT mode queries. The following examples show how to retrieve empty elements for null values.
-- Using XSINIL with ELEMENTS
SELECT ProductID, Name, Color
FROM Production.Product Product
FOR XML AUTO, ELEMENTS XSINIL