Click here to Skip to main content
15,170,078 members
Home / Discussions / Database
   

Database

 
QuestionDatabase SQL Pin
Syafiqah Zahirah10-May-14 5:47
MemberSyafiqah Zahirah10-May-14 5:47 
AnswerRe: Database SQL Pin
Peter Leow10-May-14 6:24
professionalPeter Leow10-May-14 6:24 
GeneralRe: Database SQL Pin
Syafiqah Zahirah11-May-14 4:43
MemberSyafiqah Zahirah11-May-14 4:43 
AnswerRe: Database SQL Pin
Peter Leow11-May-14 5:13
professionalPeter Leow11-May-14 5:13 
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 
Hi
I need to multiply two columns (float) each of which can have a max of 4 decimal places and round the result to 3 decimal places.

It seems the ROUND(val,decimal_places) uses bankers rounding? (SQL Sever 2008R2) - Although I have read it uses Symmetric Arithmetic Rounding?

Doing the same calculation in Excel gives me the result I need, but Excel uses normal Arithmetic rounding.

How can I do a query to use arithmetic rounding (like Excel)

Examples of the errors:

C#
Price	Qty	Val	ExcelRound	SQLRound
7.5169	745	5600.0905	5600.091	5600.090
4.3465	463	2012.4295	2012.430	2012.429
1.6401	125	205.0125	205.013	205.012
0.0395	369	14.5755	14.576	14.575
5.2349	955	4999.3295	4999.330	4999.329
9.0285	141	1273.0185	1273.019	1273.018
9.0899	645	5862.9855	5862.986	5862.985
3.6167	215	777.5905	777.591	777.590
3.1145	135	420.4575	420.458	420.457
7.4115	105	778.2075	778.208	778.207
7.8675	313	2462.5275	2462.528	2462.527
8.8405	227	2006.7935	2006.794	2006.793
5.4269	55	298.4795	298.480	298.479
1.8833	445	838.0685	838.069	838.068
9.7349	655	6376.3595	6376.360	6376.359
8.6487	365	3156.7755	3156.776	3156.775
1.9033	125	237.9125	237.913	237.912
4.8197	545	2626.7365	2626.737	2626.736


PS: how do you post a table with nicely formatted columns?

modified 9-May-14 17:33pm.

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 
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 

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.