Thread: RE: [GENERAL] Strange behaviour ?

RE: [GENERAL] Strange behaviour ?

From
"Jackson, DeJuan"
Date:
> > look up the differences between varchar and char data types.
>
> I know the difference between varchar and char, but I don't see why
> LOWER() is
> adding spaces. If this is the correct behaviour, could you kindly
> point me to
> the related docs ?
>
The LOWER() function is not adding the spaces; the char() datatype is
adding the spaces.  The "char = text" compare operator ignores the
spaces at the end of the char type.  But when you use the lower function
the type is returned as varchar() including the spaces, and the "varchar
= text" operator doesn't ignore the spaces.  Try either changing the
type to varchar which won't add the spaces to the end, or using
"LOWER(TRIM(char)) = text".

> Thanks.
>
> Bye!
>
> --
>  Daniele
>
> ----------------------------------------------------------------------
> ---------
> "On the Internet, no one knows you're using Windows NT"
> (Submitted by Ramiro Estrugo, restrugo@fateware.com)
> ----------------------------------------------------------------------
> ---------
>  Se telecom italia aggiungesse uno scatto al giorno ad ogni abbonato,
> dal
>  primo Gennaio avrebbe rubato 669.032.000.000 Lire.
> ----------------------------------------------------------------------
> ---------
>  Daniele Orlandi - Utility Line Italia - http://www.orlandi.com
>  Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
> ----------------------------------------------------------------------
> ---------