Subject Re: [IBO] Float to Numeric
Author Don Gollahon
"Helen Borrie" <helebor@...> wrote in message
> At 10:07 PM 7/01/2004 -0600, you wrote:
> Try this:
> update classsubject
> set weight = cast (cast (weight1 * 100 as numeric(7,2)) / 100 as

Ok. I thought of doing that but just wondered why a simple cast didn't
work. When I do a select statement using a cast the value returned looks
just fine. It just doesn't work right in the update statement.

> If that still seems to give you wrong outcomes, try again, upping the
> by 1 of the intermediate number by 1. If it's still not what you want,
> you'll need to look at using a UDF to do custom rounding algorithm.
> Sidenote: Actually, I'd prefer to define the new column with a higher
> precision and, if you have to limit it to a maximum, effect that with a
> CHECK constraint. It makes no difference whatsoever to the storage size,
> since Fb stores a (9,2), (8,2), (7,2), (6,2) or a (5,2) all as 32-bit
> integers anyway. To my instinct, a CHECK constraint is the tightest way
> control limits.
> Helen

Don Gollahon
ICQ#: 115831669
"What in Eternity does it matter?"