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:
00328710
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 .
>
>Regards,
>
Gerard,

You are seeing how xBase compares strings as Ed has told you. The comparison is controlled by the shorter of the two strings. Your ALLTRIM() is giving a string of 0 length so there is no comparison being done and the 'ABC' is considered equal to the 0 length string.

You can use SET ANSI (for SQL) or SET EXACT (for xBase commands) or you can change your SELECT to say;

WHERE NOT Myfield == 'ABC'
Previous
Reply
Map
View

Click here to load this message in the networking platform