BUG: Statistics Are Printed Twice with Statistics Time On (196916)



The information in this article applies to:

  • Microsoft SQL Server 7.0
  • Microsoft SQL Server 2000 (all editions)

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.

Modification Type:MajorLast Reviewed:2/23/2004
Keywords:kbBug kbpending KB196916