title: SqlDataReader and SQL Server 2016 FOR JSON splits json in chunks of 2k bytes
body: <p>Recently I played around with the new <code>for json auto</code> feature of the Azure SQL database.</p>
  
  <p>When I select a lot of records for example with this query:</p>
  
  <pre><code>Select
      Wiki.WikiId
      , Wiki.WikiText
      , Wiki.Title
      , Wiki.CreatedOn
      , Tags.TagId
      , Tags.TagText
      , Tags.CreatedOn
  From
      Wiki
  Left Join
      (WikiTag
  Inner Join 
      Tag as Tags on WikiTag.TagId = Tags.TagId) on Wiki.WikiId = WikiTag.WikiId
  For Json Auto
  </code></pre>
  
  <p>and then do a select with the C# <code>SqlDataReader</code>:</p>
  
  <pre><code>var connectionString = ""; // connection string
  var sql = "";  // query from above
  var chunks = new List&lt;string&gt;();
  
  using (var connection = new SqlConnection(connectionString)) 
  using (var command = connection.CreateCommand()) {
      command.CommandText = sql;
      connection.Open();
  
      var reader = command.ExecuteReader();
  
      while (reader.Read()) {
              chunks.Add(reader.GetString(0)); // Reads in chunks of ~2K Bytes
      }
  }
  
  var json = string.Concat(chunks);
  </code></pre>
  
  <p>I get a lot of chunks of data.</p>
  
  <p>Why do we have this limitation? Why don't we get everything in one big chunk?</p>
  
  <p>When I read a <code>nvarchar(max)</code> column, I will get everything in one chunk.</p>
  
  <p>Thanks for an explanation</p>