Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Why does 'A' = 'A ' ?
Fri, Jan 31 2014 12:25 PMPermanent Link

Barry

I was surprised this morning to find that

select 'A'='A   ';
TRUE

I always thought since the strings were of different length, the result would be False. But apparently when comparing strings, EDB does a RTrim() on the strings

It doesn't matter to me one way or the other, but I thought it rather strange because that's not the way it works in Pascal.

Barry
Fri, Jan 31 2014 5:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Barry,

<< I was surprised this morning to find that

select 'A'='A   ';
TRUE >>

This is how VARCHAR/CHAR comparisons work in the 2003 (and 92) standard.
Trailing spaces are not considered when comparing strings.

This link talks about this behavior in SQL Server:

http://support.microsoft.com/kb/316626

Tim Young
Elevate Software
www.elevatesoft.com
Image