Had a weird error today in my MS SQL Query that had worked for months.
Cannot sort a row of size 8304, which is greater than the allowable maximum of 8094
The only difference – a few text fields the query returned had larger amount of data than usual. What saved my day is ROBUST PLAN hint, when I added OPTION(ROBUST PLAN) to my ORDER BY clause – the query ran perfectly. So if you ever experience similar problem (usually it happens when you join several tables with large sets of data) try this approach.
For detailed explanation of ROBUST PLAN and other hints visit Microsoft Tech Net