PRB: Using SELECT-SQL INTO TABLE w/ Same Filename Causes ErrorLast reviewed: April 30, 1996Article ID: Q118780 |
The information in this article applies to:
SYMPTOMSThe documentation for the SELECT-SQL INTO DBF <table> | TABLE <table> command (page C3-704 in the "Commands & Functions" manual for FoxPro version 2.0 and page L3-866 in the "Language Reference" manual for FoxPro versions 2.5x and 2.6) incorrectly states that by specifying the name of a table/.DBF that is already open, FoxPro closes the file and reopens the table without giving a warning if SET SAFETY is OFF. Instead, using the same filename in the Save As dialog box causes the error message "File is in use."
CAUSEWhen a table is created with a SELECT-SQL statement, the original table is not closed as specified in the documentation when the same table name is used. FoxPro uses QUERY.DBF as the default table name when Table/DBF is selected in the Output list box. If the table name used for output is the same as the filename specified in the Tables dialog box, a syntax error is generated. In the following example, the CUSTOMER table is selected, Table/DBF is selected in the Output list box, and the default value is used in the Save As dialog box. Using these values, the following SELECT statement is generated, as illustrated by the See SQL button in the Relational Query by Example (RQBE) window.
SELECT *; FROM Customer; INTO TABLE <path>\query.dbfAfter you run the query, if you then select Table/DBF in the Output list box and then enter the same table name in the Save As dialog box (in this case, QUERY.DBF), the "File is in Use" error occurs.
RESOLUTIONTo avoid this problem, use a different name for the file instead of the same table/.DBF name used in the Save As dialog box. Because a different filename is used in the INTO TABLE clause of the SELECT statement, the error will not occur.
|
Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 Alias
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |