Thread: Casting Money To Numeric

Casting Money To Numeric

From
Thomas Good
Date:
Hi All.

Having perused all the online docs I can find it appears there is no
SQL solution for casting the dread money type to numeric.
Is this true?

select rent::numeric(9,2) from x;
ERROR: Cannot cast type 'money' to 'numeric'

I guess my cash ain't nothing but trash...  ;-)

TIA!
-----------------------------------------------------------------------
Thomas Good                                  e-mail: tomg@sqlclinic.net
Programmer/Analyst                           phone:   (+1) 718.818.5528
Residential Services                         fax:     (+1) 718.818.5056
Behavioral Health Services, SVCMC-NY         mobile:  (+1) 917.282.7359
   --            Geistiges Eigentum ist Diebstahl!              --



Re: Casting Money To Numeric

From
"D'Arcy J.M. Cain"
Date:
On November 26, 2002 02:19 pm, Thomas Good wrote:
> Having perused all the online docs I can find it appears there is no
> SQL solution for casting the dread money type to numeric.
> Is this true?
>
> select rent::numeric(9,2) from x;
> ERROR: Cannot cast type 'money' to 'numeric'

Fraid so.  That's one of the reasons that I had to finally leave that type 
for numeric.  Be prepared, however, for SUM() to take longer on groups of any 
significant size.  That's the one thing that was really nice about money - 
everything was integer arithmetic.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.