How to Force SELECT-SQL to Create Temp File for CursorLast reviewed: April 30, 1996Article ID: Q109584 |
The information in this article applies to:
SUMMARYWhen the INTO CURSOR clause of the SELECT-SQL command is used to direct output to a cursor, this cursor can take one of two forms. It can be a cursor that has its own temporary file on the disk, or it can be a filtered subset of the table that the SELECT-SQL statement was based on. A cursor can be created as a filtered view of the original table if:
The existence of a cursor on the hard disk provides the following benefits:
MORE INFORMATIONYou can force the creation of a cursor within an SELECT-SQL statement in FoxPro. To do this, use the SELECT statement to select column expressions in the field list that do not exist in the database. In a multiple-table SELECT statement, this is accomplished when fields from both tables are selected. Since the field list does not match a table directly, FoxPro will not create a mask of the database but instead will create a temporary file on disk. If only one table exists, or if you do not want to select fields from more than one .DBF file, use the following code.
* The following lines create tables for use in the SELECT-SQL below CREATE TABLE customer ; ( cno C(5), company C(35), contact C(20), ; address C(30), city C(15), state C(2), zip C(5), ; phone C(12), ono C(1), ytdpurch N(8,2), lat N(7,4), ; long N(8,4) ) INSERT INTO customer (cno, company, contact, address, ; city, state, zip, ; phone, ono, ytdpurch, lat, long) ; VALUES ('a123', '1st Company', 'No Name', 'One Microsoft Way', ; 'Redmond', 'WA', '98052', '1206123456', '1', ; 1000.99, 100.999, 100.999) * The .T. in the field list causes FoxPro to create a cursor. SELECT Customer.cno, Customer.ytdpurch, .T. ; FROM Customer INTO CURSOR QueryTo verify the existence of a temporary file for a cursor, issue the following command:
".TMP"$DBF('<alias>') |
Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.50 2.50a 2.50b
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |