PRB: "Syntax Error" Caused by SYS(3) and Name Expression

Last reviewed: June 27, 1995
Article ID: Q99912
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.5 and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SYMPTOMS

Assigning SYS(3) to a variable and then referring to that variable as a name expression for the cursor name in an SQL statement causes a "Syntax Error" in FoxPro 2.5 for MS-DOS and Windows, but not in FoxPro 2.0 for MS-DOS.

CAUSE

SYS(3) returns a character type filename that contains only numbers.

RESOLUTION

To work around this problem, do one of the following:

  • Use a character name for the cursor, as demonstrated in the following example:

          x='test'
          USE customer
          SELECT * FROM customer INTO CURSOR (x)
    
  • Use the SYS(2015) function, which returns a unique 10-character string that begins with an underscore. The SUBSTR() function must be used in this procedure. For example:

          USE customer
          SELECT * FROM customer INTO CURSOR SUBSTR(SYS(2015),2,8)
    

MORE INFORMATION

Steps to Reproduce Problem

  1. Start FoxPro 2.0.

  2. In the Command window, type the following commands:

          X=SYS(3)
          USE CUSTOMER
          SELECT * FROM CUSTOMER INTO CURSOR(X)
    

The SELECT statement works as anticipated in FoxPro 2.0. Repeat this procedure with FoxPro 2.5 for MS-DOS and Windows; a "Syntax Error" occurs after the SELECT statement is executed.


Additional reference words: FoxDos FoxWin 2.50 2.50a errmsg err msg
KBCategory: kbinterop kbprg kberrmsg kbprb
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: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.