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 |
|
montu
Yak Posting Veteran
60 Posts |
Posted - 2008-02-12 : 23:53:12
|
| Hi alli am trying to capture values between 0 and 1 calculated by some arithmetic calculation. but the problem is values less then 1 not stored it store 0 instead but i need that exact value. any idea how i can achieve this.i am using numeric(18,5) type variable to store that value |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-02-12 : 23:56:12
|
| What are source data type and formula? |
 |
|
|
montu
Yak Posting Veteran
60 Posts |
Posted - 2008-02-12 : 23:59:34
|
| SELECT 'sapce' = ((sum(reserved) * 8) / 1024) FROM sysindexes WHERE indid in (0, 1, 255)'(reserved*8)--gives values but moment i divide it wth 1024 it gives 0 |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-13 : 00:00:07
|
| Post complete code. I don't think there is anything wrong with the data type of the variable, SQL Server might be doing implicit conversion to int or some such data type before storing it to numeric variable.But nothing can be concretely said before you post your code.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-13 : 00:02:13
|
| [code]SELECT 'sapce' = ((sum(reserved) * 8.0) / 1024.0) FROM sysindexes WHERE indid in (0, 1, 255)[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
montu
Yak Posting Veteran
60 Posts |
Posted - 2008-02-13 : 00:06:14
|
| Thanks Harsh it works perfact by adding .0 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-13 : 04:21:42
|
| http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspxMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|