In the on-prem version of Dynamics, we can create our own custom indexes. And, even though it’s a supported customization (here is a reference: https://msdn.microsoft.com/en-us/library/gg328350.aspx ), there is at least one scenario which may fail.
Basically, the problem is that custom indexes are not managed by Dynamics, so what it means is that any operation which is conflicting with such an index will fail.
For instance, when applying a solution upgrade to a managed solution, and when updated version of that managed solution does not have a field on which there is, already, a custom index, you will see this error in Dynamics:
The dreaded SQL Server Error..
In my case, this error occurred because of the custom index:
Once I have removed the index, solution upgrade worked just fine:
This does not seem to be a problem for unmanaged solutions, but that’s expected since we can’t delete a field by importing an unmanaged solution. On the other hand, when importing unmanaged solutions, you may still change text field length for an existing field.. I did not try it, but I’m guessing Dynamics might not be able to publish those changes if the maximum size of all the columns included into the index exceeds 900, since there is a limit on the SQL side.