Microsoft KB Archive/99912

{| = PRB: &quot;Syntax Error&quot; Caused by SYS(3) and Name Expression =
 * width="100%"|

ID: Q99912

2.50 2.50a | 2.50 2.50a

MS-DOS    | WINDOWS kbinterop kbprg kberrmsg kbprb 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 &quot;Syntax Error&quot; 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 &quot;_&quot;+SUBSTR(SYS(2015),4) 

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 &quot;Syntax Error&quot; 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
 * }