Archive for February 18, 2015

SQL Server Error While Exporting Advanced Find Records To Excel

February 18, 2015 Leave a comment

Few Users reported that they were getting “SQL Server Error” while trying to export the Advanced Find  records to Excel.

SQL Server Error while exporting records

SQL Server Error while exporting records

Reason :

  • The filter they used in Advanced Find resulted more than 10000 records.
  • CRM has OOB limit of 10000 records to export.
  • If your CRM instance is on premise, you can check the limit by querying OrganizationName_MSCRM database.
  • Below is the query
    • SELECT MaxRecordsForExportToExcel FROM OrganizationBase

Fix :

  • You can increase the value of “MaxRecordsForExportToExcel”.

Supported Way

  • Updating the MaxRecordsForExportToExcel using CRM SDK call is Supported.
  • This will work for both on premise and online instances

Organization organization = new Organization();

organization.Id = {Oragnization GUId}; // Get Org GUID from MSCRM_Config DB’s Organization table.

organization.MaxRecordsForExportToExcel = 300000; // Set desired value


Unsupported Way

  • As you aware its strictly not recommended to update CRM database directly and also this approach only works for on premise.
  • Run below query by connecting to your OrganizationName_MSCRM Database.

UPDATE OrganizationBase


MaxRecordsForExportToExcel = 100000