Actually it's acting the way I would expect, which is like a "C" compiler:

If all of the numbers appear to be ints then it does integer math.
If *any* of the numbers is a float then it does float math. 

Try this expression instead and see what you get:
icode=tblDomReportData.rpoints/2.0

Since "2.0" looks like a float it will return a float.

        Mark


-----Original Message-----
From: Joshua Miller [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 12:04 PM
To: CF-Talk
Subject: RE: T-SQL division drops the decimal?


Thanks all for the help, this is what ended up working:
icode=(CAST(tblDomReportData.rpoints AS float))/2

Very odd in my opinion, I would think that the math functions in T-SQL
would be a bit more elegant than that. I suppose if T-SQL gets the value
"4" irregardless of what datatype it is it always changes to INT when
doing division. Bizarre.

Thanks for the assistance!

Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net
[EMAIL PROTECTED]
(704) 569-0801 ext. 254
 
************************************************************************
*************
Any views expressed in this message are those of the individual sender,
except where the sender states them to be the views of 
Garrison Enterprises Inc.
 
This e-mail is intended only for the individual or entity to which it is
addressed and contains information that is private and confidential. If
you are not the intended recipient you are hereby notified that any
dissemination, distribution or copying is strictly prohibited. If you 
have received this e-mail in error please delete it immediately and
advise us by return e-mail to [EMAIL PROTECTED]
************************************************************************
*************


-----Original Message-----
From: Paul Hastings [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 31, 2003 11:53 AM
To: CF-Talk
Subject: Re: T-SQL division drops the decimal?


> I have a query that takes a value from the database and divides by 2 
> and inserts that value into another table, however SQL Server (T-SQL) 
> drops the decimal place, so 1/2 of 1 is 0 according to T-SQL.

you're telling sql server to divide 2 int, it returns what you asked of
it, an int. i always either cast or more often simply: "1/2.0"




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to