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 |
|
DENIZ3E
Yak Posting Veteran
56 Posts |
Posted - 2005-02-24 : 17:14:04
|
| HI..I add a row as shown below in the table but when I select it from query analyzer, ý see @loss=83.29999999999999997 but ý want to see@loss=83.5 why?DECLARE @LOSS floatselect @loss=83.3INSERT TABLE VALUES(@LOSS..)2.DECLARE @LOSS FLOATSELECT @LOSS=14.456898SELECT ROUND(@LOSS,2)I SEE 14.450000 BU I WANT TO SEE 14.45 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-02-24 : 17:23:17
|
thats not how float works.Try:DECLARE @LOSS decimal(8,1)select @loss=83.3Select @LOSSDECLARE @LOSS decimal(8,2)SELECT @LOSS=14.456898SELECT @LOSSSELECT ROUND(@LOSS,2)Corey "If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain |
 |
|
|
DENIZ3E
Yak Posting Veteran
56 Posts |
Posted - 2005-02-24 : 17:32:01
|
| very thanks.. |
 |
|
|
DENIZ3E
Yak Posting Veteran
56 Posts |
Posted - 2005-02-24 : 17:39:17
|
| SELECT @LOSS=14.456898SELECT @LOSSý see @loss=14.456898 I ADD A ROW IN TABLE HOW SHOULD BE THE @LOSS VARIABLY..OR SELECT @LOSS=14.456898SELECT @LOSSI SEE @LOSS=14.45 HOW SHOULD BE THE @LOOS VARIABLY |
 |
|
|
marisouc
Starting Member
1 Post |
Posted - 2005-03-03 : 16:29:05
|
| HI, I've noticed the same kind of problem in our database:-The original data in TableA is 85.3 -I've extracted it from a query in Query Analyser and put it into TableB-If I read it (into TableB) from Enterprise Manager I see 85.3 but if I read it from within Query Analyser (still TableB) I see 85.3000000001 ?!?!?!?!The only thing I've noticed is the format of the field. In TableA the field is NUMERIC and in TableB it's FLOAT. Can this be the reason of the "scrap" added in the field? If so, how can I avoid it without changing the format of the field? |
 |
|
|
|
|
|