Using relational operators for CHAR

UDA
Enthusiast

Using relational operators for CHAR

i wanna know how the reltional functions works out with CHAR

EG

SEL CASE WHEN '00t' > '003' THEN 1 ELSE 0 END returns 0 and

SEL CASE WHEN '00t' > '030' THEN 1 ELSE 0 END returns 1

why???
4 REPLIES
Enthusiast

Re: Using relational operators for CHAR

*bump*.....Man!!!! no one knows this????
Enthusiast

Re: Using relational operators for CHAR

What exactly are you trying to find out?
Which character had greater binary value?? or which is the succeeding number in storage?
Can you rephrase?
Junior Supporter

Re: Using relational operators for CHAR



This is not true (at least not in my system):

SEL CASE WHEN '00t' > '003' THEN 1 ELSE 0 END;

SEL CASE WHEN '00t' > '003' THEN 1 ELSE 0 END;

*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.

------------------
1

BTEQ -- Enter your DBC/SQL request or BTEQ command:
SEL CASE WHEN '00t' > '030' THEN 1 ELSE 0 END;

SEL CASE WHEN '00t' > '030' THEN 1 ELSE 0 END;

*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.

------------------
0

Look for ASCII table for the answer...

Cheers.

Carlos.
Enthusiast

Re: Using relational operators for CHAR

Even I got the same result as Carlos.
Deepak. Across products the ACSII table will remain the same.
http://www.asciitable.com/