title: Copy all Rows to another Table in Azure Table Storage
body: <p>What is the best way to copy all the rows from one table to another table?<br>
  I tried below code to get all the rows in a table:  </p>
  
  <pre><code>    TableServiceContext _dataContext;
      public IEnumerable&lt;T&gt; GetAllEntities()
      {
          IQueryable&lt;T&gt; query = null;
          try
          {
              query = _dataContext.CreateQuery&lt;T&gt;(_tableName);
          }
          catch (Exception ex)
          {
  
          }
          return query.ToArray();
      }
  </code></pre>
  
  <p>but it doesnt get rows more than around 900.
  I have few hundreds of thousands of rows.<br>
  Updated Code:</p>
  
  <pre><code> public class TableRepository&lt;T&gt; : IRepository&lt;T&gt; 
      where T : TableEntity
  {
      protected readonly string _tableName;
      protected readonly TableServiceContext _dataContext;
      protected readonly CloudTable _tableReference;
  
      public TableRepository(string tableName, CloudTableClient tableClient)
      {
          _tableName = tableName;
          _dataContext = tableClient.GetTableServiceContext();
          _tableReference = tableClient.GetTableReference(tableName);
          _dataContext.ResolveType = ResolveEntityType;
          _dataContext.MergeOption = System.Data.Services.Client.MergeOption.NoTracking;
      }
  
      public IEnumerable&lt;T&gt; GetAllEntities()
      {
          List&lt;T&gt; allEntities = new List&lt;T&gt;();
          try
          {
              Microsoft.WindowsAzure.Storage.Table.TableContinuationToken tableContinuationToken = null;
              do
              {
                  var queryResponse = _tableReference.ExecuteQuerySegmented&lt;T&gt;(null, tableContinuationToken, null, null);
                  tableContinuationToken = queryResponse.ContinuationToken;
                  allEntities.AddRange(queryResponse.Results);
              }
              while (tableContinuationToken != null);
  
          }
          catch (Exception ex)
          {
              throw new DALException(_tableName,_dataContext.BaseUri.OriginalString, "An error occured while querying data", ex);
          }
          return allEntities;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>but with error: </p>
  
  <blockquote>
    <p>Error 121 'T' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'TElement' in the generic type or method 'Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteQuerySegmented</p>
  </blockquote>