Subject | Re: [IBO] Float to Numeric |
---|---|
Author | Don Gollahon |
Post date | 2004-01-08T06:17:09Z |
"Helen Borrie" <helebor@...> wrote in message
news:<5.2.0.9.2.20040108163551.04269a70@...>...
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.
Don Gollahon
dlgllhn@...
ICQ#: 115831669
"What in Eternity does it matter?"
_________________________________________
news:<5.2.0.9.2.20040108163551.04269a70@...>...
> At 10:07 PM 7/01/2004 -0600, you wrote:numeric(5,2))
>
> 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 thescale
> by 1 of the intermediate number by 1. If it's still not what you want,to
> 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
dlgllhn@...
ICQ#: 115831669
"What in Eternity does it matter?"
_________________________________________