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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Nothing only curious...Rounding Float Values

Author  Topic 

ZarrinPour
Yak Posting Veteran

66 Posts

Posted - 2008-05-03 : 06:54:33
Hi all
I have a Float Field in my table with following values:

1.63
7.42
35.71
0.58

every thing is ok BUT when i Select Data from this table in
QUERY ANALIZER environment with (Select * from mytable) , Query Analizer shows me the following values:

1.6299999999999999
7.4199999999999999
35.710000000000001
0.57999999999999996

Why? while i don't have this problem in Enterprise manager !!!

Thanks in advance.
Kind Regards.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-05-03 : 07:17:08
If you want exact precision, use

select cast(col as decimal(16,2)) from mytable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ZarrinPour
Yak Posting Veteran

66 Posts

Posted - 2008-05-03 : 07:31:33
quote:
Originally posted by madhivanan

If you want exact precision, use

select cast(col as decimal(16,2)) from mytable

Madhivanan

Failing to plan is Planning to fail



Thanks madhivanan
But what's wrong with Query Analizer? is there any option for this?
I couldn't find any !!
Any way thanks.
Go to Top of Page
   

- Advertisement -