FIX: Subquery That References Table with No Statistics and Returns Empty Result Set May Cause AV

Article translations Article translations
Article ID: 299448 - View products that this article applies to.
This article was previously published under Q299448
BUG #: 351984 (SHILOH_BUGS)
Expand all | Collapse all


When executing a statement that contains a subquery, if the subquery references a large table with no statistics but the subquery itself returns no rows, an access violation (AV) may occur.


To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack


Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.


The SQL Server error log contains a stack trace similar to the following:
Short Stack Dump
00571E6C Module(sqlservr+00171E6C) (OptimizerUtil::FStatsCouldHelp(class CValRef *)+00000063)
00572CE0 Module(sqlservr+00172CE0) (CScaOp_Comp::CalcSelectivity(class CTreeHandle *,class CSelContext #amp;,class CSelOut #amp;)+00000479)
0053CD78 Module(sqlservr+0013CD78) (CalculateLeftSemiJoin(class CSelOut #amp;,class CTreeHandle *,class CSelContext #amp;,class IMemObj *,class CCardVector #amp;,class CCardVector #amp;,class CCardVector #amp;,class CPvrBitSet * *,class DRgCId *,class CDensityGroup * *,cla
005705D8 Module(sqlservr+001705D8) (CSelContext::CalculateSelectivity(class CGroupExpr *,class CTreeHandle *,class CCardVector #amp;,class CXVariant * *)+000000CE)
0057171C Module(sqlservr+0017171C) (CalcCard(class IMemObj *,int,enum JOINTYPE,class CGroupExpr *,class CTreeHandle *,unsigned long,class CTableGroupProperties *,class CTableGroupProperties *,class CTableGroupProperties *)+0000046A)
0057104F Module(sqlservr+0017104F) (GroupCardFromSel(class CTreeHandle *,class CTableGroupProperties *)+000001A1)
0055B530 Module(sqlservr+0015B530) (ComputeGroupProperties(class CVtTableGroupProperty *,class CTreeHandle *,class CTableGroupProperties *)+000000CB)
0053CCB3 Module(sqlservr+0013CCB3) (CLogOp_LeftSemiJoin::DeriveGroupProperties(class CTreeHandle *)+0000006B)
0055AB2B Module(sqlservr+0015AB2B) (COpArg::DeriveNormalizedGroupProperties(class CTreeHandle *)+0000001B)
004BADD1 Module(sqlservr+000BADD1) (COptExpr::ReDeriveGroupProperties(unsigned long)+00000082)
004BAD7B Module(sqlservr+000BAD7B) (COptExpr::ReDeriveGroupProperties(unsigned long)+0000002C)
0055E881 Module(sqlservr+0015E881) (COptContext::PexprSimplify(class COptExpr *)+000003AD)
0055DE4F Module(sqlservr+0015DE4F) (COptContext::PcxteOptimizeQuery(class COptExpr *,class DRgCId *)+000004E5)
0055FFBB Module(sqlservr+0015FFBB) (CQuery::Optimize(void)+00000416)
0055FD54 Module(sqlservr+0015FD54) (CQuery::Optimize(unsigned long)+00000030)
005642C6 Module(sqlservr+001642C6) (CCvtTree::PqryFromTree(class TREE *,class IMemObj *,class CRangeCollection *,unsigned long,class CCompPlan *)+000002C4)
00564019 Module(sqlservr+00164019) (BuildQueryFromTree(class TREE *,class IMemObj *,class IMemObj *,class IQueryObj * *,class CRangeCollection *,unsigned long,class CCompPlan *)+00000046)
00563F78 Module(sqlservr+00163F78) (CStmtQuery::InitQuery(class CAlgStmt *,class CCompPlan *,unsigned long)+0000014B)
0049DA48 Module(sqlservr+0009DA48) (CStmtSelect::Init(class CAlgStmt *,class CCompPlan *,class IBrowseMode *)+00000091)
00447078 Module(sqlservr+00047078) (CCompPlan::FCompileStep(class CAlgStmt *,class CStatement * *)+00000AE7)
004510FE Module(sqlservr+000510FE) (CProchdr::FCompile(class CCompPlan *,class CParamExchange *)+00000D15)
00415080 Module(sqlservr+00015080) (CSQLSource::FTransform(class CParamExchange *)+0000037C)
004592CE Module(sqlservr+000592CE) (CSQLStrings::FTransform(class CParamExchange *)+000001A8)
0041534F Module(sqlservr+0001534F) (CSQLSource::Execute(class CParamExchange *)+00000176)
00459A54 Module(sqlservr+00059A54) (language_exec(struct srv_proc *)+000003C8)
004175D8 Module(sqlservr+000175D8) (process_commands(struct srv_proc *)+000000E0)
410735D0 Module(UMS+000035D0) (ProcessWorkRequests(class UmsWorkQueue *)+00000264)
4107382C Module(UMS+0000382C) (ThreadStartRoutine(void *)+000000BC)
7800BEAB Module(MSVCRT+0000BEAB) (_beginthread+000000CE)
77F04EDE Module(KERNEL32+00004EDE) (lstrcmpiW+000000BE)


Article ID: 299448 - Last Review: November 5, 2003 - Revision: 3.2
  • Microsoft SQL Server 2000 Standard Edition
kbbug kbfix kbsqlserv2000sp1fix KB299448

Give Feedback


Contact us for more help

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