FIX: Query Using Nested IN and a CASE Clause Causes an Access Violation

Article translations Article translations
Article ID: 279319 - View products that this article applies to.
This article was previously published under Q279319
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57966 (SQLBUG_70)
Expand all | Collapse all

SYMPTOMS

Running a query with two or more nested IN clauses and a CASE statement may cause the connection to be broken and the following error to be returned:
ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 7 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process. Connection Broken

CAUSE

The query caused a handled exception in SQL Server, and the process was stopped.

WORKAROUND

To work around this problem, replace the IN clause with a SELECT COUNT(1) > 0 statement. For example, part of the query that looks like the following:
CASE
   WHEN T1.F1 IN (SELECT T2 FROM T2) THEN value1
   ELSE value2
END
				
Can be rewritten as:
CASE
   WHEN (SELECT COUNT(1) FROM T2 WHERE T1.F1 = T2.F2) > 0 THEN value1
   ELSE value2
END
				

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.

Properties

Article ID: 279319 - Last Review: October 21, 2013 - Revision: 2.1
APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB279319

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com