Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Float Error
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

samir.first
Starting Member

Egypt
34 Posts

Posted - 04/26/2014 :  04:03:02  Show Profile  Reply with Quote
SELECT ItemID,CurrentQuantity ,ComputedCurrentQuantity
SUM(AddQuantity -ExQuantity ) OVER ( PARTITION BY ItemID ORDER BY FullDate ROWS UNBOUNDED PRECEDING) FROM SC_ItemsCurrentValues
all data type is float
CurrentQuantity is value insert and ComputedCurrentQuantity is recalculate this value
the Result is
CurrentQuantity ComputedCurrentQuantity
60.62 60.62
but when add column CurrentQuantity - ComputedCurrentQuantity
the Result is
CurrentQuantity ComputedCurrentQuantity Deferent
60.62 60.62 -9.09494701772928E-13
Please I need Solved it

nagino
Yak Posting Veteran

Japan
75 Posts

Posted - 04/27/2014 :  20:15:18  Show Profile  Reply with Quote
by design
Float type is floating-point number
use Decimal type

-------------------------------------
From Japan
Sorry, my English ability is limited.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000