Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 1.22 KB

generate-elements-for-null-values-with-the-xsinil-parameter.md

File metadata and controls

26 lines (22 loc) · 1.22 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic helpviewer_keywords
Generate elements for NULL values with XSINIL
Learn how to generate XML elements for NULL values by using the XSINIL parameter on the ELEMENTS directive.
MikeRayMSFT
mikeray
randolphwest
05/05/2022
sql
xml
conceptual
FOR XML clause, null values
null values [SQL Server], XML
ELEMENTS directive
XSINIL parameter

Generate elements for NULL values with the XSINIL parameter

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

The ELEMENTS directive constructs XML in which each column value maps to an element in the XML. By default, if the column value is NULL, no element is added. But by specifying the optional XSINIL parameter on the ELEMENTS directive, you can request that an element is created for the NULL value. In this case, an element that has the xsi:nil attribute set to TRUE is returned for each NULL column value.

See also