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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Float datatype

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2010-11-10 : 21:00:12
Hi,

I have a table to store float value, the value is imported from excel to the table. I have a value 6.3 in excel but when store the the table, it is changed to 6.2999999999999998. Any possibility causing this and anyway to avoid the value being changed?

Thanks.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-11-10 : 21:19:35
float is approximate value. Use NUMERIC or DECIMAL with required precision instead.

refer to BOL http://msdn.microsoft.com/en-us/library/ms173773.aspx
quote:
Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly.



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -