Click here to Skip to main content
15,177,283 members
Home / Discussions / Database
   

Database

 
GeneralRe: Database SQL Pin
Syafiqah Zahirah11-May-14 5:45
MemberSyafiqah Zahirah11-May-14 5:45 
GeneralRe: Database SQL Pin
Syafiqah Zahirah15-May-14 7:50
MemberSyafiqah Zahirah15-May-14 7:50 
GeneralRe: Database SQL Pin
Peter Leow15-May-14 15:47
professionalPeter Leow15-May-14 15:47 
QuestionArithmetic rounding Pin
Richard.Berry1009-May-14 12:04
MemberRichard.Berry1009-May-14 12:04 
AnswerRe: Arithmetic rounding Pin
Richard Andrew x649-May-14 13:26
professionalRichard Andrew x649-May-14 13:26 
GeneralRe: Arithmetic rounding Pin
Richard.Berry1009-May-14 21:58
MemberRichard.Berry1009-May-14 21:58 
AnswerRe: Arithmetic rounding Pin
Andrius Leonavicius9-May-14 16:02
professionalAndrius Leonavicius9-May-14 16:02 
GeneralRe: Arithmetic rounding Pin
Richard.Berry1009-May-14 21:45
MemberRichard.Berry1009-May-14 21:45 
Hi Andrius

Thanks So much.

Tested below with the same random sample of 300 values, and all agreed with the Excel Values!

SQL
select price
, qty
, price*qty as Val
, round(CONVERT(decimal(12,4),price)* CONVERT(decimal(12,4),qty),3) as RoundVal
from dbo.[round] 


What mis-lead me into thinking the problem was with the type of rounding was that from my sample of 300 values, all the values that differed had a 5 in the 4th decimal place, and all the errors were not rounded as expected.

In the link you poseted:


Using float and real Data

The float and real data types are known as approximate data types. The behavior of float and real follows the IEEE 754 specification on approximate numeric data types.
...
The IEEE 754 specification provides four rounding modes: round to nearest, round up, round down, and round to zero. Microsoft SQL Server uses round up. All are accurate to the guaranteed precision but can result in slightly different floating-point values. Because the binary representation of a floating-point number may use one of many legal rounding schemes, it is impossible to reliably quantify a floating-point value.


Thanks for your help!
GeneralRe: Arithmetic rounding Pin
Andrius Leonavicius10-May-14 5:28
professionalAndrius Leonavicius10-May-14 5:28 
QuestionFetch records efficiently Pin
avi_dadi20029-May-14 10:15
Memberavi_dadi20029-May-14 10:15 
AnswerRe: Fetch records efficiently Pin
Richard Andrew x649-May-14 11:30
professionalRichard Andrew x649-May-14 11:30 
AnswerRe: Fetch records efficiently Pin
Richard MacCutchan9-May-14 22:49
mveRichard MacCutchan9-May-14 22:49 
QuestionNeed to fetch from two data sources Pin
avi_dadi20029-May-14 10:11
Memberavi_dadi20029-May-14 10:11 
AnswerRe: Need to fetch from two data sources Pin
Richard.Berry1009-May-14 22:40
MemberRichard.Berry1009-May-14 22:40 
QuestionSSAS Cube Pin
Mycroft Holmes6-May-14 15:42
professionalMycroft Holmes6-May-14 15:42 
QuestionNeed help in forming a query Pin
Member 99559846-May-14 1:07
professionalMember 99559846-May-14 1:07 
AnswerRe: Need help in forming a query Pin
Richard MacCutchan6-May-14 1:21
mveRichard MacCutchan6-May-14 1:21 
Questionlogin and logout differenece at back end Pin
Syed Rehman5-May-14 19:59
MemberSyed Rehman5-May-14 19:59 
AnswerRe: login and logout differenece at back end Pin
Mycroft Holmes5-May-14 20:20
professionalMycroft Holmes5-May-14 20:20 
QuestionMigration error from SQL 2014 to SQL 2012 Pin
Kala Vairakkannu5-May-14 8:48
MemberKala Vairakkannu5-May-14 8:48 
AnswerRe: Migration error from SQL 2014 to SQL 2012 Pin
ZurdoDev5-May-14 10:36
professionalZurdoDev5-May-14 10:36 
QuestionMigration error from SQL 2014 to SQL 2012 Pin
Kala Vairakkannu5-May-14 8:27
MemberKala Vairakkannu5-May-14 8:27 
AnswerRe: Migration error from SQL 2014 to SQL 2012 Pin
Kornfeld Eliyahu Peter5-May-14 8:34
professionalKornfeld Eliyahu Peter5-May-14 8:34 
GeneralRe: Migration error from SQL 2014 to SQL 2012 Pin
ZurdoDev5-May-14 8:48
professionalZurdoDev5-May-14 8:48 
GeneralRe: Migration error from SQL 2014 to SQL 2012 Pin
Kala Vairakkannu5-May-14 9:16
MemberKala Vairakkannu5-May-14 9:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.