FIX: A severe error occurs when you run a query that uses CTEs against the partitioned tables in SQL Server

Applies to: SQL Server 2012 EnterpriseSQL Server 2012 DeveloperSQL Server 2012 Standard More


When you run a query that uses Common Table Expression (CTE) which joins with a partitioned table in Microsoft SQL Server 2012 or SQL Server 2014. You may receive the following error message during the execution of the query:
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
This issue occurs when the following conditions are true:
  • The join is on a predicate that uses $PARTITION Transact-SQL statement.
  • The join uses a hash join parallel execution plan.


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

Cumulative Update 4 for SQL Server 2014

Cumulative Update 2 for SQL Server 2012 SP2

Cumulative Update 11 for SQL Server 2012 SP1


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