Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What happens with SELECT
Message
From
20/07/2006 12:09:09
 
 
To
20/07/2006 12:00:27
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01138114
Message ID:
01138121
Views:
11
>I am trying to gain a better understanding of what happens with SELECT INTO CURSOR. If I issue a command such as
>select * from somefile into cursor crsTemp
>
>
>It appears that the original file (somefile) is opened by the OS although it is not technically USED. Is this correct? If yes, then what do we have to do to close the file so that it is available to other programs or so that it can be overwritten? I have tried to
>
>use in crsTemp
>copy to somefile
>
>but I still get an error that says the file is open. Can someone shed some light on this?
>
>Thanks

SELECT always open all files which are involved in it. Sometimes it does not create cursor but use the table with filter that is in WHERE clause in SELECT. I don't know what version of BFP you use but since VFP8 we have NOFILTER clause which prevents filtered table use. In previous versions you could add an additional field to get real cursor not filtereed table:
SELECT *, .f. AS Dummy FROM MyTable INTO CURSOR crsTest
if you want to close all tables that are used in select you could use AUSED() before and after SELECT compare two arrays and close all tables chich is not used before SELECT.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform