Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-13 : 08:12:13
|
| Mala writes "Hi ,Please have a look at the following example.create table TEST(VAL1 decimal(20,2), val2 decimal(10,2))insert into testvalues(10,100)select val1/val2 as val from testval ----------------------------------- .1000000000000select 10/100 val1 ,val1/val2 val2 from testval1 val2 ----------- ----------------------------------- 0 .1000000000000Why do we get result like this in sql. Regards,Mala" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-01-13 : 08:16:25
|
| Integer arithmetic. SELECT 10/100 will give zero because integers do not contain decimals. SELECT 10.0/100.0 will give you 0.1 as a result because the .0 casts the numbers as float datatype. |
 |
|
|
|
|
|