I am receiving errors when I run the following query:
SELECT (
SELECT 1
FROM dbo.AccountEntry AE
WHERE AE.Account = P.Account
)
FROM dbo.Proposal P
WHERE P.id = @Id
When run via ADO.NET it gives:
Warning: Fatal error 3624 occurred at Jun 20 2016 2:28AM. Note the error and time, and contact your system administrator. A severe error occurred on the current command. The results, if any, should be discarded.
When run in SSMS it gives
Location: statutil.cpp:4128
Expression: iKey < m_statBlob.GetHeader()->GetKeyCount()
SPID: 59 Process ID: 1732
Msg 3624, Level 20, State 1, Line 1
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.
Interestingly this code works when setting @Account to P.Account:
select 1 from dbo.AccountEntry AE where AE.Account = @Account
I have tried restarting the server.
I have tried dropping all indexes and statistics.
I have run DBCC CHECKDB and it returns no errors.
We don't believe anything has been changed about the server since Friday when it was running happily.
SQL Version: Microsoft SQL Server 2012 - 11.0.5343.0 (X64) May 4 2015 19:11:32 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.2 (Build 9200: ) (Hypervisor)