SQL Server Forums
Profile | Register | 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
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

samir.first
Starting Member

Egypt
28 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
65 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000