-----Original Message-----
From: Joe Gooch [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 09, 2004 1:15 PM
To: CF-Talk
Subject: RE: SQL calculating question
SELECT 10.0 / 20 * 12 = 6
SELECT CAST(10 as numeric(9,4))/20 * 12 = 6
A normal constant is treated as an integer, I believe, for which it is
doing integer / integer = integer result. If you make one a numeric, it
knows numeric / integer = numeric.
Joe
-----Original Message-----
From: Eric Creese [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 09, 2004 1:23 PM
To: CF-Talk
Subject: SQL calculating question
> select 10/20 * 12 = 0
> select 12 * 10/20 = 6
>
>
> Both calculations are correct in theory. Unfortunately SQL does not
deal well with decimals.
>
> If you divide a lesser number with greater number it gives a values
less than 0 which SQL rounds to its nearest whole number and so you get
ZERO, which is multiplied with 12 to get the same. Is there a
function that can be wrapped around the 10/12 to display the decimal and
not zero?
>
>
_____
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

