>>Using macro substitution inside a query is a bad idea anyway because it forces SQL to evaluate the macro for every row, and slows the query dramatically. HTH
>
>Erik, are you sure about this? If yes, then try some quick test.
>Actually, this is UDF which might be evaluated for each row.
No, I am not sure, Ed, it's just what I have always been told. (This was also discussed in one of the DevCon sessions... I'll have to look at my notes to remember which one.)
I did one quick test though...
lfilter = "lname = 'Moore'"
before1 = seconds()
select * from campus into cursor cursor1 where &lfilter
after1 = seconds()
elapsed1 = after1 - before1
wait window "Query1: " + str(elapsed1)
Wait window returned "Query1: 23"
I then exited VFP, returned and changed the code to:
before2 = seconds()
lquery = 'Select * from campus into cursor cursor2 where lname = "Moore"'
&lquery
after2 = seconds()
elapsed2 = after2 - before2
wait window "Query2: " + str(elapsed2)
Wait window returned "Query1: 11"
I realize this isn't the most dependable of tests, but nothing better came immediately to mind. Have you tested for the performance difference? I am interested to hear the results.
Erik Moore
Clientelligence