• Ryan Riley (11/7/2007)


    Great article, Jacob. I think you might have mentioned this previously, but is there a limit to the number of characters an XML query will return? Also, is there a way to get around this limitation? My queries keep coming back as only the first several thousand characters.

    Thanks!

    Ryan,

    I do not think there is a limitation. The following query returns an XML stream that is half a million characters long.

    DECLARE @x XML

    SELECT @x = (

    select * from sys.columns for xml auto

    )

    SELECT LEN(CAST (@x as VARCHAR(MAX)))

    /*

    OUTPUT:

    --------------------

    417597

    (1 row(s) affected)

    */

    .