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 |
|
amodi
Yak Posting Veteran
83 Posts |
Posted - 2010-09-21 : 01:03:25
|
| Dear Friends,when i run query in sql server as follows:select (1/100) the result is 0, where as i want 0.01How could i achieve this ?Many Thanks,AmodiNo paiN No gaiN |
|
|
Ancy
Starting Member
23 Posts |
Posted - 2010-09-21 : 01:08:00
|
| select convert(numeric,1)/100 |
 |
|
|
amodi
Yak Posting Veteran
83 Posts |
Posted - 2010-09-21 : 01:09:54
|
| Thanks a Million for your quick reply.No paiN No gaiN |
 |
|
|
Ancy
Starting Member
23 Posts |
Posted - 2010-09-21 : 01:12:02
|
| You are welcome :) |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-09-21 : 01:13:09
|
| Try thisselect (1/100.0)The dividend must be a float !Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
amodi
Yak Posting Veteran
83 Posts |
Posted - 2010-09-21 : 01:41:53
|
| Thank you all.No paiN No gaiN |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-09-21 : 07:22:54
|
quote: The dividend must be a float !
Not necessarily, it just needs to support decimal values:declare @m money, @n numeric(10,2)select @m=12, @n=12select 1/@m, 1/@n, 1/12e -- E suffix denotes numeric type |
 |
|
|
|
|
|