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 |
|
baguhan
Starting Member
3 Posts |
Posted - 2011-01-24 : 06:11:36
|
| can somebody help me how can i display the decimal no. on this script?declare @x decimal(5,2)select @x=(1*9)/24select @xresult is : 0.00on calculator the result is : 0.375 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-01-24 : 07:24:48
|
| In SQL Server, an integer divided by an integer is an integer, so .375 becomes 0.00.declare @x decimal(5,2)select @x=(1.0*9)/24 -- turns the integer into a numericselect @xJimEveryday I learn something that somebody else already knew |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|