Sentence: For Xml

  • Hello,

    How can I get the columns with null values on the xml output, but without the use of xsinil?? is it possible??

    basically, I execute the query:

    SELECT col1, col2, col3, col4

    FROM Table

    WHERE x > y

    FOR XML RAW('Movement'), ELEMENTS, ROOT('SPEI')

    but the columns with null values not appeared on the xml output,

    the problem is if they dont appeared, the xml is rejected by the schema, and this schema is not on my hands to modified.

  • Danky,

    This should work, depending on datatypes:

    SELECT ISNULL( col1, 'NULL'), ISNULL( col2, 'NULL),....

    FROM Table

    WHERE x > y

    FOR XML RAW('Movement'), ELEMENTS, ROOT('SPEI')


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • excelent!, thanks Criag...

    It works very well

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

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