Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable in SELECT command
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00018551
Message ID:
00018576
Views:
32
>>>>Anybody know the proper syntax for the following SELECT statement, where p_PayeeName is a public variable. As it is now, it isn't searching for the value of the variable.
>>>>
>>>>SELECT payee_code, payee_name;
>>>> FROM wc!payee2;
>>>> WHERE payee2.payee_name like '%p_PayeeName%';
>>>> ORDER BY payee_name
>>>
>>>Try using a macro '&varname', varname='%p_payeename%'
>>
>>Thanks for the help, but what's a macro? Where would I put this?
>>
>Macro uses '&' -- it goes after the like:
>WHERE payee2.payee_name like '&varname';

Thanks again! I think I'm getting closer! However, now I have another problem. When I use the following, it works fine (finding exact matches only):

WHERE payee2.payee_name like '&pPayeeName';

But when I add percent signs for wildcards (to find matches containing the variable value), like this:

WHERE payee2.payee_name like '%&pPayeeName%';

It doesn't work, even if I type a complete field value, it doesn't find any matching records. The manual states I can user % and _ for wildcards, but doesn't give the syntax.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform