|
View previous topic :: View next topic
|
| Author |
Message |
Ashsih
New User
Joined: 20 Dec 2007 Posts: 29 Location: India
|
|
|
|
how MAX on a CHAR column work?
Wha will be result of query if contain both number and charcter. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
it depends ...
in a plain ebcdic environment letters come before numbers
max("A","Z","0","9") will be "9"
min("A","Z","0","9") will be "A"
in an ascii environment the other way around
max("A","Z","0","9") will be "Z"
min("A","Z","0","9") will be "0"
also remember that in an ebcdic environment the letters are not contiguos
there are also other concerns.:
...strict non_strict equality
in a strict equality "AA " will be different from "AA"
... case sensitivity |
|
| Back to top |
|
 |
Ashsih
New User
Joined: 20 Dec 2007 Posts: 29 Location: India
|
|
|
|
Thanks!!!!!!!!!!!
Supposed i am using DB2 and my colm has follwing valuse then what will be the o/p of MAX query.
ABC
A23
23A
999
o/p - ? |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Ashsih,
Your answer was given above - in ebcdic, numbers are "higher" than letters.
In your example data, 999 would be the highest. |
|
| Back to top |
|
 |
Ashsih
New User
Joined: 20 Dec 2007 Posts: 29 Location: India
|
|
|
|
| Thanks!!!!!!! |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome
d |
|
| Back to top |
|
 |
|
|