Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using == vs =
Message
From
08/11/2015 14:40:20
 
 
To
08/11/2015 13:59:12
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01627149
Message ID:
01627228
Views:
61
>>>I am absolutely convinced that you are wrong. I am curious to see if you can prove your statement.
>
>I think we're both right- sort of! VFP Help confirms that if two strings are compared with the == operator, the expressions must contain exactly the same characters, including blanks, to be considered equal and that SET EQUAL is ignored.
>
>
CREATE CURSOR c1 (myfield1 c(10),myfield2 c(11))
>
>? c1.myfield1==c1.myfield2
>? c1.myfield2==c1.myfield1
>
>INSERT INTO c1 VALUES ("Hello","Hello")
>
>? c1.myfield1==c1.myfield2
>? c1.myfield2==c1.myfield1
>
>
>.F.
>.F.
>.F.
>.F.
>
>However if using SQL, == acts the same as = with SET ANSI ON- IOW the shorter string is padded.
>
>
CREATE CURSOR c1 (myfield1 c(10), myfield2 c(11))
>
>INSERT INTO c1 VALUES ("Hello","Hello")
>
>SELECT * FROM c1 WHERE myfield1==myfield2
Well, to be honest I answered to what I was sure you meant, which was not what you wrote. You wrote "I have seen issues comparing fields of unequal length, where == always fails" which is of course always false. I thought you meant to say that you have seen cases where this comparison resulted in true.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform