Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alltrim bug ??
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00328666
Message ID:
00328679
Views:
14
>I have the following test ,cant understand it... it must be a bug
>
>Select MYFILE (20 records on file)
>Replace All Myfield with Space(1)
>
>Select * from Myfile where Myfield <> 'ABC'
>.... returns 20 records
>
>Select * from Myfile where Alltrim(Myfield) <> 'ABC'
>.... returns zero records
>
>Can anybody explain this .

Yep - this has to do with the SET ANSI setting and SQL - I suggest that you read thesections in the on-line doc for details. The following is an excerpt from the SELECT-SQL topic:

When you use the = operator with strings, it acts differently depending on the setting of SET ANSI. When SET ANSI is set to OFF, Visual FoxPro treats string comparisons in a manner familiar to Xbase users. When SET ANSI is set to ON, Visual FoxPro follows ANSI standards for string comparisons. See SET ANSI and SET EXACT for additional information about how Visual FoxPro performs string comparisons



Try using SET ANSI ON before the query
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform