title: sql server FOR XML has a character limit?
body: <p>I'm executhing a query in xml and converting it into an xml file with FOR XML EXPLICIT. And this works, unless of I try to query a lot for files.</p>
  
  <p>If I query the records with IDs between 400 and 500 it works if I try to query the records with IDs between 500 and 600 it works but if I try to query 400 to 600 it fails.</p>
  
  <p>This is the error:</p>
  
  <blockquote>
    <p>Unable to show XML. The following error happened: '', hexadecimal
    value 0x1E, is an invalid character. Line 1457, position 107.</p>
    
    <p>One solution is to increase the number of characters retrieved from
    the server for XML data. To change this setting, on the Tools menu,
    click Options.</p>
  </blockquote>
  
  <p>Okay? and then what? Where do I have to make the change in options exactly?</p>
  
  <p>Edit: Setting XML Data to unlimited under the Query results > SQL Server > Results to grid to unlimited does not work.</p>
  
  <p>Edit: returned with code:</p>
  
  <pre><code>&lt;ExceptionDocument&gt;&lt;Error&gt;&lt;Message&gt;'&amp;#x1E;', hexadecimal value 0x1E, is an invalid character. Line 953, position 107.&lt;/Message&gt;&lt;StackTrace&gt;   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
     at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
     at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, Int32 invCharPos)
     at System.Xml.XmlTextReaderImpl.ParseCDataOrComment(XmlNodeType type, Int32&amp;amp; outStartPos, Int32&amp;amp; outEndPos)
     at System.Xml.XmlTextReaderImpl.ParseCDataOrComment(XmlNodeType type)
     at System.Xml.XmlTextReaderImpl.ParseElementContent()
     at System.Xml.XmlTextReaderImpl.Read()
     at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
     at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
     at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
     at System.Xml.XmlDocument.Load(XmlReader reader)
     at System.Xml.XmlDocument.LoadXml(String xml)
     at SitePublisher.Base.BasePub.ExecuteCommand(String sql, Int32 attempt, NameValueCollection parameters)&lt;/StackTrace&gt;&lt;InnerException /&gt;&lt;/Error&gt;&lt;/ExceptionDocument&gt;
  </code></pre>
  
  <p>Edit: I'm guessing 0x1E is an end of file character.</p>
  
  <p>Edit: I think my first statement might have been wrong and that I'm dealing with corrupt data. It always returns an error for record 426.</p>