When you run a query that tries to spill more than 65,535 extents to the tempdb database, an numeric overflow occurs. Therefore, an incorrect is returned.
This issue occurs because you can't read all the extents back after overflow.
Cumulative update informationThe issue was first fixed in the following cumulative update of SQL Server:
- Cumulative Update 11 for SQL Server 2012 Service Pack 2
- Cumulative Update 2 for SQL Server 2012 Service Pack 3
- Cumulative Update 5 for SQL Server 2014 SP1
- Cumulative Update 12 for SQL Server 2014
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.