FIX: SQLStatistics function returns incorrect sort order sequence (831801)



The information in this article applies to:

  • Microsoft Data Access Components 2.7
  • Microsoft SQL Server 2000 (all editions)
  • Microsoft SQL Server 7.0
  • Microsoft ODBC Driver for SQL Server

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 "A" 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: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 "Applies to" section.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start SQL Query Analyzer.
  2. Connect to the pubs database of SQL Server.
  3. 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
  4. Start the ODBC Test tool.
  5. 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 "A" is returned for all the indexes.

REFERENCES

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

For additional information about the ODBC Test, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MajorLast Reviewed:4/7/2006
Keywords:kbQFE KBHotfixServer kbbug kbfix KB831801 kbAudDeveloper