>>I want to run several queries in a row. However, I don't want them hardcoded in a program.
>>
>>What I did was build a query statement (without the word SELECT at the beginning) within a memo field in a file.
>>
>>In my program, I ran the code:
>>
>>=====================================================
>>
>> select queryfile
>> do while !eof('queryfile')
>>
>> SELECT DISTINCT queryfile.qrymemo
>>
>> {process something if query finds a hit}
>>
>> skip 1 in queryfile
>> enddo
>>
>>=====================================================
>>
>>The field qrymemo is my memo field containing the SQL statement.
>>
>>I'm just winging this. Does anyone know how I can run a SELECT statement and substitute in the body of the SQL statement?
>>
>>Any and all help is greatly appreciated.
>>
>>Rob
>
>Use the '&string' for this. I've never tried an entire SELECT '&etc', but it works for parts of it.
Bingo!
I figured it out before seeing your message, but more times than not I won't.
Instead of:
SELECT DISTINCT queryfile.qrymemo
I used:
STORE queryfile.qrymemo TO qrytext
SELECT DISTINCT &qrytext
It gives me exactly what I want.
Thanks again for the help.
Rob
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement