Weird Select Behavior
2004-08-05 13:54:22
Hi everyone. I've been struggling with this for a time now and can't seem
to come up with an answer on my own. I hope one of you might be able to
explain it to me.
When I run a simple sum select statement from the physical_mb field of the
occupancy table I get one answer. However, when I run the same select, but
cast the result as decimal I get a wildly different result. I expected it
to just format the output and get rid of some of the trailing decimal
places. I looked at the syscat.columns occupancy stuff and it says the
physical_mb field is decimal, so I don't understand the behavior.
Obviously, there's something I just don't know about the select behavior.
Here are the two scripts and their output. Any help is appreciated.
tsm: MSPTSM01COL>select sum(physical_mb/1000000) from occupancy
Unnamed[1]
---------------------------------
70.29775000000000000000000
tsm: MSPTSM01COL>
tsm: MSPTSM01COL>select sum(cast (physical_mb/1000000 as decimal(6,2))) as
"Total TB" from occupancy
Total TB
---------------------------------
66.17
tsm: MSPTSM01COL>
curtis.stewart AT lawson DOT com
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- Weird Select Behavior,
Curtis Stewart <=
|
|
|