I am trying to get XML using a SELECT and For XML EXPLICIT keyword. If the column has NULL value in database, then It does not return the XML attribute. I want the attribute to be there with null or blank value. How can i do it ?
Example
SELECT 1 AS Tag,
NULL AS Parent,
NULL AS [Root!1!Root],
NULL AS [Link!2!Id],
NULL AS [Link!2!Parameters]
UNION ALL
SELECT 2 ,
1,
NULL,
LD.Id,
LD.Parameters
From Link LD
FOR XML EXPLICIT
It return
<Root><Link Id="1"/><Link Id="2"/></Root>
It does not return the attribute "Parameters= """ which i need.
Desired Output
<Root><Link Id="1" Parameters= ""/><Link Id="2" Parameters= ""/></Root>