General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>>
>>>Also, rather that using AFIELDS, you could
>>>SELECT * FROM tablename INTO CURSOR cursorname NOFILTER
>>>to get a copy of your original table for reporting.
>>
>>You raise an interesting point here Mark. That sure is a way to create a cursor based on an existing structure. The cursor will contain every record in the original dataset. I often want an empty cursor.
>>You could go
>>SELECT * FROM tablename WHERE .F. INTO CURSOR cursorname NOFILTER
>>however this is not Rushmore optimizable (try it on a huge dataset!)
>>So....
>>Does anyone know a fast one liner for creating an empty cursor based on an existing structure?
>
>Just an interesting tidbit here- when you open a view with the NODATA clause, internally, VFP uses an SQL statement like the following to return an empty cursor:
>
>SELECT * FROM MyTable WHERE 1=0
>
>I learned this on accident when a my error handler trapped the incorrect executing line of code, and this showed up.
Hi Eric,
I just did some timing tests on this one and it runs same time as 'WHERE .F.', but strangely it appears to be fully optimised, and so does 'WHERE .F.'.
Perhaps FPW2.6 didn't optimise these things but VFP does ???
FWIW .F. is a little faster than 1=0 on my setup.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only