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 |
|
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2006-07-27 : 08:44:40
|
| Hi,I am keeping the datatype as float to display time in hour.I i insert 0.30 value ,in sql database value is stored as 0.3000000001987 if i use real datatype then value gets truncated to 0.3but i want to store it as 0.30 exactly. how can i do this?Swati |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-27 : 08:51:44
|
| A float isn't an exact datatype.Why do you want to use it?If you want the hour then a tinyint would probably do.Otherwise why not a smalldatetime?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-27 : 10:30:39
|
quote: Originally posted by Swati Jain if i use real datatype then value gets truncated to 0.3
Swati, What do you mean by this? Since precision for Real data type is 7 digits, how can you possibly get 0.3 instead of 0.3000000. Otherwise use numeric datatype where you can specify no. of decimal places.Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-27 : 10:57:59
|
| It's just the way it is converted to characterTry select convert(decimal(18,16),convert(real, 0.3))select convert(real, 0.3)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|