FIX: Numeric and Decimal Datatypes Do Not Always Use an Index

Last reviewed: June 27, 1997
Article ID: Q165510
The information in this article applies to:
  • Microsoft SQL Server, version 6.5 Service Pack 2
BUG #: 16301

SYMPTOMS

A query can be very slow if the qualifying column used in the where clause is either a numeric or decimal data type. The query can be slow even if the columns have indexes. A show plan of the query shows that the optimizer chooses to do a table scan rather than use the index.

This problem only occurs in Microsoft SQL Server version 6.5 Service Pack 2. Earlier versions of SQL Server do not have this problem.

WORKAROUND

Change your query to use another column as the qualifier, or use a composite index with the first part of the index key not being a decimal or numeric data type. Another workaround is to change the qualifying column used in the where clause to truly be numeric or decimal. For example, instead of using 9, use 9.0, or do a convert to numeric or decimal.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5 Service Pack 2. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.


Keywords : kbbug6.50.sp2 kbusage SSrvGen
Version : 6.5 sp2
Platform : WINDOWS
Issue type : kbbug
Resolution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.