Re: Exact match using INLIST() by Jack
Jack
Wed Sep 12 12:30:07 PDT 2007
On Wed, 12 Sep 2007 10:54:56 -0700, David <David.Aman@dpsnc.net>
wrote:
>On Sep 12, 1:10 am, "Roger Ansell" <no...@realemailaddress.net> wrote:
>> In addition to Rush's advice re Set Ansi, the
>> VFP InList() function can be a little confusing
>> concerning string comparisons. When used in an SQL
>> statement, InList respects the Set Ansi setting
>> whereas on its own, it respects the Set Exact
>> setting.
>>
>> To avoid this confusion (and to make your SQL
>> statements more portable) you can use SQL's
>> native IN comparison operator, eg...
>>
>> Select * From mytable where myfield In ("apples","oranges")
>>
>> -Roger
>>
>> "David" <David.A...@dpsnc.net> wrote in message
>>
>> news:1189539138.448711.172620@i38g2000prf.googlegroups.com...
>>
>>
>>
>> > Hi --
>>
>> > Using VFP9 + XPPro.
>>
>> > I tried to use the INLIST() function in an SQL SELECT statement to get
>> > only certain information from a table. I used SET EXACT ON before
>> > running the statement. However, this did not result to "exact"
>> > matches.
>>
>> > For example, I asked for 'African American', but I received 'African
>> > American', as well as 'African American Females', and 'African
>> > American Males'. I finally had to redo the statement without the
>> > INLIST() function and use the "==" convention.
>>
>> > Thanks in advance for any clarification or advice.
>>
>> > David- Hide quoted text -
>>
>> - Show quoted text -
>
>Thank you, Roger. That is interesting. Are there other commonly used
>VFP functions that have similar characteristics...behaving one way in
>an SQL statement, but a little differently when used on its own?
It's not that the statement behaves differently, but that string
equality behaves differently. Any VFP function (if there are any
others) that compares strings will show the same behavior.