How to "exclude" a column for some records in XML result?

  • I am working on outputting XML from T-SQL, and have gotten to the point where my output is pretty much like I want it.

    There is a requirement in the specifications of the XML file I need to produce, that states something like "If value is known, provide it. Otherwise, do not include the column".

    How can I specify that a particular column of a particular record NOT be included in the output of the XML from a T-SQL SELECT... FOR XML...?

    Thanks



    Once you understand the BITs, all the pieces come together

  • As is in SQL to offer the data you cannot unless you are not showing for all the ouput at all.

  • Thanks for the reply... In the mean time, I noticed that at least when I use "...for XML AUTO, Elements", the columns where all records in set have a NULL value, are NOT output into the XML document. Is this the "standard" bevahior?



    Once you understand the BITs, all the pieces come together

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply