Knowledge Base

BUG: Statistics Are Printed Twice with Statistics Time On

Article ID: 196916

Article Last Modified on 2/23/2004


APPLIES TO


This article was previously published under Q196916
BUG #: 37972 (SHILOH)

SYMPTOMS

When you execute a query with statistics time on, you will see the statistics printed in the results window twice.

CAUSE

Auto-parameterization is a new feature in SQL Server 7.0. Using parameters or parameter markers in Transact-SQL statements increases the ability of the relational engine to match new SQL statements with existing, unused execution plans. If an SQL statement is executed without parameters, SQL Server 7.0 parameterizes the statement internally to increase the possibility of matching it against an existing execution plan.

Because the server tries to use Auto-parameterization the query is partially compiled twice. The first time is to parse and Auto-parameterize the query. The second time the query is compiled is when the plan is put into cache.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Keywords: kbbug kbpending KB196916