Microsoft KB Archive/831801

= FIX: SQLStatistics function returns incorrect sort order sequence =

Article ID: 831801

Article Last Modified on 11/5/2007

-

APPLIES TO


 * Microsoft Data Access Components 2.7
 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft ODBC Driver for Microsoft SQL Server 3.7

-





SYMPTOMS
When you connect to Microsoft SQL Server 2000 or to Microsoft SQL Server 7.0, and you call the SQLStatistics ODBC function, you may notice that the collation is always returned as &quot;A&quot; regardless of the sort order sequence.

You may also notice this behavior when you run the sp_statistics system stored procedure.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.   Date      Time   Version      Size   File name --  20-Nov-2003  01:01                    937,168  Instcat.sql 04-Dec-2003 01:34                      1,228  Readme.txt Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior
 Start SQL Query Analyzer. Connect to the pubs database of SQL Server.  Run the following Transact-SQL statement: CREATE TABLE [dbo].[IndexJDE1] ( [Col1] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,  [Col2] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,  [Col3] [int] NOT NULL  ) ON [PRIMARY] GO

CREATE INDEX [IX_IndexJDE1] ON [dbo].[IndexJDE1]([Col1], [Col2]) ON [PRIMARY] GO

CREATE INDEX [IX_IndexJDE1_1] ON [dbo].[IndexJDE1]([Col2] DESC, [Col3]) ON [PRIMARY] GO

CREATE INDEX [IX_IndexJDE1_2] ON [dbo].[IndexJDE1]([Col1] DESC ) ON [PRIMARY] GO

CREATE INDEX [IX_IndexJDE1_3] ON [dbo].[IndexJDE1]([Col2], [Col3], [Col1]) ON [PRIMARY] GO  Start the ODBC Test tool. Connect to the pubs database of the SQL Server and then run the SQLStatistics function for the IndexJDE1 table that is created in Step 3.

You may notice that collation &quot;A&quot; is returned for all the indexes.</li></ol>

<div class="references_section">