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

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
service.Update(organization);
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
SET
MaxRecordsForExportToExcel = 100000
🙂

![[Step by Step] Configure and run 'Pipelines in Power Platform'](https://rajeevpentyala.com/wp-content/uploads/2024/08/image.png)
![[Beginners] Power Fx: ShowColumns, AddColumns, RenameColumns and DropColumns](https://rajeevpentyala.com/wp-content/uploads/2024/04/record-ezgif.com-video-to-gif-converter-1-2.gif)
Leave a comment