Assume that you use Microsoft SQL Server 2008 R2, SQL Server 2012, or SQL Server 2014. When you execute a query by using TOP N and ORDER BY, the query hits an assert failure similar to the following:

Location: "qstopsrt.cpp":384
Expression: fFalse
Process ID: <ProcessID>
Location: qxcntxt.cpp:1052
Expression: cref == 0
Process ID: <ProcessID>
Msg 3624, Level 20, State 1, Line 2
A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a QFE from Technical Support.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.

Note The fix may also apply to that the query plan contains "Sort (Top N Sort)."


The issue occurs because an internal error in the query execution engine.

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:


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

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!