FIX: Incorrect results occur in a rare scenario when you run a query that contains a nested loop join and performance spool in its inner side in SQL Server 2012 or 2014

Applies to: SQL Server 2012 StandardSQL Server 2014 EnterpriseSQL Server 2014 Enterprise More

Symptoms


When you run a query that contains a nested loop join, SQL Server may add a spool to the inner side of the nested loop during query optimization for performance reasons. In very rare cases, this nested loop may have more outer references than the number of references that are used by the inner side of the same join.

During query runtime, the outer reference values may change. In some situations, the values may change for only those references that are not used by the inner side of the nested loop. In these situations, the added performance spool can interpret this change incorrectly. Therefore, it returns incorrect results.

Cause


This issue occurs because of a problem in the performance spool.

Cumulative Update information

This issue was first fixed in the following cumulative update of SQL Server.


Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References


Learn about the terminology that Microsoft uses to describe software updates.