Joshua,

MS SQL automatically returns the type you use.  Looks to me like you are
dividing 2 integers.

You need to cast or convert at least one of the numbers to float to get a
float returned.

This got to be such a pain for me that I wrote a function to do the division
(MSSQL 2000).

It converts both numbers to float and then checks for nulls and zero.  If
there is a null or zero I just return a 0.0 (due to the bus requirements
here).

If you want the functions, let me know.

Steve


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


How do others on the list deal with this?
 
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.
 
Any idea how to overcome this? That seems really odd .... if I WANTED to
round I could use FLOOR() or CEILING() to round, why make it the default
in T-SQL ????
 
Thanks,
 
Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net <http://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
<mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED]
************************************************************************
*************
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

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

Reply via email to