Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dividing 10 by 100
Message
 
 
To
19/10/2004 23:48:29
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00952879
Message ID:
00952984
Views:
12
This message has been marked as a message which has helped to the initial question of the thread.
Mike,

Use floating point numbers instead:

select 10.0 / 100.0

You are using integer constants which result in integer results and 10 / 100 as an integer is 0. Which is in your second example then cast to numeric(3,2) but there is no fractional left part to cast.

Or you have to cast at least one of your operands into numeric first:

SELECT CAST( cast(10,numeric(3,2) / 100,NUMERIC(3,2)) -- (although I don't have my SQL running right now so I can't test this before posting)

>Im trying to get the quotient for (10/100) in SQL. I run this query using SQL Query Analyzer
>
>SELECT 10/100
>
>The result displayed is 0. I also tried this query SELECT CAST((10/100),NUMERIC(3,2))
>but still, the result returned is zero.
>
>Is there another way to return the decimal value (quotient) of the query above?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform