FIX: SQL Select Inconsistency with SET ANSI OFF and ALLTRIM()

Last reviewed: January 22, 1996
Article ID: Q142887
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0

SYMPTOMS

Using an ALLTRIM() function with an SELECT-SQL statement when SET ANSI=OFF may result in the return of an incorrect subset of records.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual FoxPro 3.0b for Windows.

MORE INFORMATION

Steps to Reproduce Problem

  1. Create a program file, and enter the following lines of code into it:

    ************ Begin Program *******************

    CREATE TABLE x1 (id C(4)) INSERT INTO x1 VALUES("AB") INSERT INTO x1 VALUES("CD")

    CREATE TABLE x2 (id C(4)) INSERT INTO x2 VALUES ("ABC") INSERT INTO x2 VALUES ("CDE")

    SET ANSI OFF SELECT x1.* FROM x1,x2 WHERE ALLTRIM(x1.id)=ALLTRIM(x2.id)

    ************* End Program ********************

  2. Run the program created in step 1. No records are returned from the SELECT statement when there should be two records returned.

  3. Change "CREATE TABLE x2 (id C(4))" to "CREATE TABLE x2 (id C(5))" in the program created in step 1.

  4. Run the program again. The records are returned correctly.


Additional reference words: 3.00 buglist3.00 fixlist3.00b VFoxWin
KBCategory: kbprg kbfixlist kbbuglist
KBSubcategory: FxprgSql


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: January 22, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.