Hi Hilmar
SELECT IIF(not table='CUSTPAYMENT',999999999999,newid('CUSTPAYMENT')) as nextid ;
FROM ids WHERE table='CUSTPAYMENT' INTO CURSOR tNextId
executes the stored procedure twice even though there is only one record in with table='CUSTPAYMENT'
I have tried with RECNO() also but no success. Maybe I am not understanding you correctly,
do you have an example?
Thanks
Geoff
>Did I understand correctly, that you want to execute the stored procedure only for records that fulfill other criteria?
>
>One way would be to add the stored procedure at the end of a series of AND statements. Shorcut Boolean evaluation should take care of only evaluating the function when the previous conditions are .T.
>
>>Hi
>>
>>How do I create an SQL SELECT statement that uses a stored procedure (or other procedure) so that that procedure is only called when there is a valid record in the when statement.
>>
>>Foxpro currently calls the procedure during the initialisation phase of the select and then again for each row in the WHERE. Is it possible to avoid the initialisation call?
>>
>>Regards
>>Geoff Scott
May all your weeds be wildflowers