Subject | Using Cast() to truncate? |
---|---|
Author | Joe Martinez |
Post date | 2004-12-07T23:21:20Z |
I am trying to use the following update to multiply a field by 2.25, but I
want the resulting number (stored in vpmsrp, which is a DOUBLE PRECISION
field) to be truncated to 2 decimal places. The following query:
update vendorproducts set vpmsrp = cast((vpcost * 2.25) as numeric (18,2) )
however, doesn't work. I did the cast, hoping that by casting to a 18,2
data type, that it would truncate it, but that doesn't happen. The
resulting values of vpmsrp have more than 2 decimal places.
Why doesn't that work? And, how can I modify that statement to make it work?
-Joe
want the resulting number (stored in vpmsrp, which is a DOUBLE PRECISION
field) to be truncated to 2 decimal places. The following query:
update vendorproducts set vpmsrp = cast((vpcost * 2.25) as numeric (18,2) )
however, doesn't work. I did the cast, hoping that by casting to a 18,2
data type, that it would truncate it, but that doesn't happen. The
resulting values of vpmsrp have more than 2 decimal places.
Why doesn't that work? And, how can I modify that statement to make it work?
-Joe