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>

[EMAIL PROTECTED]

Reply via email to