Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exactly equal (==)

Status
Not open for further replies.

Rottdpogs

IS-IT--Management
Jul 17, 2001
86
CN
Please advice. Does EXACTLY EQUAL (==) on a sql statement differs or the same as equal (=)?

settings:
set exact off
set ansi on

Example:
select * from goods left outer join sales on alltrim(goods.pro_id) = alltrim(sales.pro_id)


I just wanna make sure that my output are correct.

Thanks in advance.
 
From the help file:
The == operator can be used when an exact comparison of
character strings is needed. If two character expressions are compared with the == operator, the expressions on both sides of the == operator must contain exactly the same characters, including blanks, to be considered equal. The SET EXACT setting is ignored when character strings are compared using ==. See SET EXACT for more information on using the == operator to compare character strings.

You also can use the equal to (=) operator in this version of Visual FoxPro to determine if two object references refer to the same object.
 
According to the Help file (you do have one?), SET ANSI ON will cause the EQUAL ('=') compare to act like '=='. A quick test with ANSI ON and OFF should verify this.

Rick
 
As long as you are using ALLTRIM() on both sides of the = as in your example, you should be OK.

Ed Please let me know if the suggestion(s) I provide are helpful to you.
Sometimes you're the windshield... Sometimes you're the bug.
smallbug.gif
 
I disagree with Eguy
lc1 = "1234"
lc2 = "1234567"
lc1=lc2 is false
lc2=lc1 is true

David W. Grewe
Dave@internationalbid.com
 
David,
Be cafeful, since SET ANSI is only meaningful inside SQL statements, your comparisons aren't appropriate if just run from the command window (or in a program).

Rick

 
With SQL statements, I agree what dgrewe memtioned above. I am using alltrim()+"==" more than alltrim()+"=" to make sure the output is correct. Can someone tell what is the differenty of running speed between "==" and "="?

Peter



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top