Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using % in sql passthrough Help
Message
From
03/12/2001 14:44:48
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00588867
Message ID:
00588870
Views:
18
This message has been marked as the solution to the initial question of the thread.
Your first approach should work if you append the '%' to the variable before the SQLEXEC call. Also, I don't think you need the quotes around the variable.
gcLast = alltrim(gcLast) + '%'
SQLEXEC(gnConnHandle,[select * from patients where lastname like ?gcLast])
>Depending on the fields the user fills in, I need to build
>a sqlpass though statement that search fields based on the beginning of the string:
>
>Example: The user enters KE in a textfield which is stored to gcLast
>
>I want to be able to return a result set where all the last names start with KE
>
>Here is one of the ways I tried
>
>SQLEXEC(gnConnHandle,[select * from patients where lastname like '?gcLast%'])
>
>I though I just about had it with this one:
>
>
>select * from patients
>    where {fn locate(?gcLast,lastname)}>0
>    AND {fn locate(?gcFIRST,firstname)}>0
>
>
>
>But I gues locate finds a match anywhere in the string, thus if I enter
>KE for the lastName
>R for the firstname
>
>it will find records:
>
>KELLY, KIRK
>KELLY, ROGER
>
>When I really just wanted it to find KELLY, ROGER
>
>Help Please
Thanks,
Dan Jurden
djurden@outlook.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform