Solution on MS Access and Informix Sorting
Posted in 2001
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Hi All, <p>Here after 2 years we finally have a solution with MS Access and infromix sorting problems. This is a reference from a technet cd from mirosoft. I posted this problem a while back but didn't get a solution. After some more digging we found this below. The fixes work. <br> <p>PSS ID Number: Q235960 <p>Article last modified on 11-04-2000 <br> <p>WINDOWS:97 <br> <br> <br> <br> <p>====================================================================== <p>------------------------------------------------------------------------------- <p>The information in this article applies to: <br> <p>- Microsoft Access 97 <p>------------------------------------------------------------------------------- <br> <p>Advanced: Requires expert coding, interoperability, and multiuser skills. <br> <p>SYMPTOMS <p>======== <br> <p>When you run a query that uses an ORDER BY statement on a linked table, you may <p>receive the following error message: <br> <p>The ORDER BY clause is not valid because column, "col name," is not part of <p>the result table. <br> <p>CAUSE <p>===== <br> <p>You are unable to use the ORDER BY statement on a non-Primary Key field. <p>Microsoft Jet does not make the necessary ODBC call, <p>SQLGetInfo(SQL_ORDER_BY_COLUMNS_IN_SELECT), to retrieve the information <p>necessary to include ORDER BY columns in the SELECT statement. <br> <p>When you run a query using Jet 3.5x, Jet obtains table indexes and issues a <p>"pre-query" that selects all the indexed columns and retains the remaining part <p>of the query issued by Access. For example, if the following query is issued <p>from Access against a table called Test1 with fields A, B, C, D, E, and F, <p>having a unique index on A, B, and C <br> <p>Select D,E,F from Test1 order by D,E,F <br> <p>the "pre query" would be: <br> <p>Select A,B,C from Test1 order by D,E,F <br> <p>This "pre-query" extends beyond the ANSI-92 standards and is rejected by some of <p>the relational database management systems, such as DB2. Other relational <p>database management systems, such as Microsoft SQL Server, ORACLE, and others, <p>allow this "pre-query" to succeed. (Strict ANSI-92 compliance dictates that <p>ORDER BY columns must also be in the SELECT list.) <br> <p>RESOLUTION <p>========== <br> <p>First, install the latest release of Microsoft Data Access Components MDAC <p>2.1.2.4202.3 (GA). You can download MDAC 2.1.2.4202.3 (GA) from the following <p>Microsoft Web site: <br> <p><A HREF="http://www.microsoft.com/data">http://www.microsoft.com/data</A> <br> <p>Then, if you are running Microsoft Windows 95, Microsoft Windows 98, or and <p>Microsoft Windows NT, install the Microsoft Jet 3.5 SP3 update. This is not <p>necessary if you are running Microsoft Windows 2000. For additional information <p>about how to obtain the Microsoft Jet 3.5 SP3 update, please click the article <p>number below to view the article in the Microsoft Knowledge Base: <br> <p>Q172733 ACC97: Updated Version of Microsoft Jet 3.5 Available for Download <br> <p>STATUS <p>====== <br> <p>Microsoft has confirmed this to be a problem in the Microsoft products listed at <p>the beginning of this article. <br> <p>MORE INFORMATION <p>================ <br> <p>In addition to obtaining the Jet update listed in the "Resolution" section, if <p>you are using the IBM DB2 OS/390 ODBC driver, you must also install an IBM <p>Driver Patch (Fixpack 9). The IBM DB2 OS/390 ODBC driver version v5.1.2 <p>incorrectly returns "N" instead of "Y" when responding to a call to <p>SQLGetInfo(SQL_ORDER_BY_COLUMNS_IN_SELECT). <br> <p>You can obtain the IBM Driver Patch (Fixpack 9) from the IBM FTP site at the <p>following address: <br> <p><A HREF="ftp://ftp.software.ibm.com/ps/products/db2/fixes/english-us/db2ntv5/FP9_WR21113/">ftp://ftp.software.ibm.com/ps/products/db2/fixes/english-us/db2ntv5/FP9_WR21113/</A> <br> <p>Steps to Reproduce Problem <p>-------------------------- <br> <p>1. Click Start, point to Settings, and then click Control Panel. <br> <p>2. In Control Panel, double-click the ODBC Data Sources (32-bit) icon. <br> <p>3. In the ODBC Data Source Administrator dialog box, click the Tracing tab, and <p>then click Start Tracing Now. <br> <p>4. Open Query Manager in SQL Server 7.0 or ISQL/w in SQL Server 6.x. <br> <p>5. To create a new table, run the following code: <br> <p>CREATE TABLE test1 <br> <p>( <br> <p>Field1 char(4), <br> <p>Field2 char(4), <br> <p>Field3 char(4), <br> <p>Field4 char(4), <br> <p>Field5 char(4), <br> <p>Field6 char(4) <br> <p>) <br> <p>GO <br> <p>CREATE UNIQUE INDEX testCompIdx <br> <p>ON Test1 (Field1,Field2,Field3) <br> <p>GO <br> <p>INSERT INTO Test1 (Field1,Field2,Field3,Field4,Field5,Field6) <br> <p>VALUES ('A','B','C','D','E','F') <br> <p>6. Open an Access 97 database and link a table to the SQL Server table that you <p>created in step 4. <br> <p>7. Create a new query called Query1 in Design view without adding any tables. <br> <p>8. In the Query1 query, on the View menu, select SQL, and type the following: <br> <p>SELECT Field4,Field5,Field6 <p>FROM dbo_Test1 <p>ORDER BY Field4,Field5,Field6 <br> <p>9. Save and run Query1. <br> <p>10. Open the ODBC trace file in Notepad to review the query. You see the <p>following text: <br> <p>SELECT "dbo"."Test1"."Field1","dbo"."Test1"."Field2","dbo"."Test1"."Field3" <p>FROM "dbo"."Test1" ORDER BY "Field4" ,"Field5" ,"Field6" <br> <p>11. Close the database and delete the ODBC trace log. <br> <p>Additional query words: pra <br> <p>====================================================================== <p>Keywords : kbdta <p>Version : WINDOWS:97 <p>Issue type : kbbug <p>Solution Type : kbfix <p>============================================================================= <p>Copyright Microsoft Corporation 2000. <br> <br> </html>