Generally though, you want to cast(moneyfield as float) not int.  int will
strip off the cents...

-----Original Message-----
From: Sean Daniels [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, November 15, 2001 1:20 PM
To: CF-Talk
Subject: Re: convert from money to number


On Thursday, November 15, 2001, at 04:03  PM, Bryan Love wrote:

> wrap each number in a val() function.  It forces numeric conversion
>

If you want to do the conversion on the SQL side, you can also do this:

select safevalue = cast(moneyfield as int)
from tablename

Then refer to queryname.safevalue. I haven't tested this, but it should 
work. I wouldn't think it would be any more efficient than Bryan's 
suggestion unless you were returning a really huge number of rows from 
the DB.

> hi everyone. im have a sql backend with a field that has the type of 
> "money". once i get this field into my cf page, i want to them perform 
> math functions on it (division, addition, etc.) so that i can 
> calculate different
> values. i keep getting the error "Cannot convert to number." what is the
> best way to convert these money values to numbers, so that i can then
> perform math functions on them. thanks so much.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to