FIX: Incorrect query result when you use varchar(max) variable in the search condition in SQL Server 2014 or 2016

Applies to: SQL Server 2014 DeveloperSQL Server 2014 DeveloperSQL Server 2014 Enterprise

Symptoms


Consider the following scenario:
  • You execute a query that contains a search condition with, at least, two equality predicates on the same limited size character column (using either OR or IN clause).
  • You define a varchar(max) variable and use it in one or more equality predicates described above.
  • You specify the RECOMPILE query hint in the query.
In this scenario, the query may return incorrect results.

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.