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
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)