Ted: Thanks! I kinda halfway know this but a great refresher none the less. Like most, this has bit me a number of times until I remember it yet again VFP compares strings! Regards, Jack
Jack Skelley Senior Director, Programming/Computer Operations New Jersey Devils (973)757-6164 [email protected] ________________________________________ From: ProfoxTech [[email protected]] on behalf of Ted Roche [[email protected]] Sent: Wednesday, March 12, 2014 9:57 AM To: [email protected] Subject: Re: SQL Select not working as expected On Wed, Mar 12, 2014 at 9:24 AM, Paul Newton <[email protected]>wrote: > Am I missing something blindingly obvious? > Not obvious, but a VFP fundamental: all string comparisons compare the left string to the right up to the end of the right string, so "Smythe' = "Sm" and consequently, "Everything" = "" which means, all strings equal the empty string, so no string can NOT equal the empty string. ALLTRIM(SPACE(100)) <> SPACE(0) && False And worse, ALLTRIM(" My string is here ") <> SPACE(0) && also false. This carries over into the SQL evaluation, which leads to the confusing result you see. Testing the length of the trimmed string is one way to avoid this. -- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/7d9e7f72b813014c8fd022cf04f820edede41...@ex08.drdad.thenewarkarena.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

