• Toreador (5/21/2010)


    Oleg Netchaev (5/20/2010)


    select * from #t for xml auto, root('rows');

    This will prevent the problems with XML segment problem as the result will include the root element.

    Nope, doesn't work for me, I still get the error "An invalid character was found in text context".

    Can someone tell me why the answer "XML segment, that is invalid in any environment" is incorrect?

    Even the explanation seems to say that this is the correct answer

    'Most of chars used in example are invalid in XML, see http://www.w3.org/TR/REC-xml#charsets.'

    How did you try to open the file? I followed these steps:

    - Run code with output to text mode

    - Select output, right-click, Copy

    - On desktop: right-click, New, Text file

    - Double-click "new text file.txt"; click edit / paste; save changes and close editor

    - Right-click "new text file.txt"; click rename; change ".txt" to ".xml"

    - Double-click "new text file.xml" or right-click, click Open with, Internet Explorer (use Choose program if it's not in the list)

    The explanation does not sayy that these characters are invalid in any environment; they are indeed invalid, but browsers may choose to support them anyway. IE does that, Firefox doesn't (I just tested this).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/