Math.Round和SQL Server Round [英] Math.Round and SQL Server Round

查看:99
本文介绍了Math.Round和SQL Server Round的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定在应用程序中舍入的最佳方法我是建造的b $ b。不幸的是,似乎SQL Server和VB.NET以不同的方式在
中循环。


SQL Server


选择回合(123.465,2)


返回


123.470


我认为是正确的。


VB.NET


Math.Round(123.465,2)


返回


123.46


通过在线帮助,我已经读过VB.NET的做法是叫做

四舍五入到最近,或者是银行家的四舍五入。


我想我的第一个问题是什么是正确的(确定税收或销售时

价格)?

我的下一个问题是标准化的最佳方法是什么?我可以制作

SQL Server就像VB.NET或VB.NET就像SQL Server一样吗?


SQL Server或VB中是否还有其他功能。 NET,我是否缺少



此外,似乎行为在整个VB.NET

环境中是一致的( formatcurrency和formatpercent)。


应用程序的某些部分对SQL有意义

服务器计算一些数字和其他地方感觉

VB.NET to。


谢谢

I''m trying to determine the best approach for rounding in an application I''m
building. Unfortunately it appears as though SQL Server and VB.NET round in
different ways.

SQL Server

select round(123.465,2)

returns

123.470

Which I think is correct.

VB.NET

Math.Round(123.465, 2)

returns

123.46

Through online help I have read that the VB.NET way of doing it is "called
rounding to nearest, or banker''s rounding."

I guess my first question is what is correct (when determining Tax or Sale
prices)?

My next question is what is the best approach for standarizing? Can I make
SQL Server act like VB.NET or VB.NET act like SQL Server?

Are there additional functions either in SQL Server or VB.NET that I am
missing?

Also it appears as if the behavior is consistent throughout the VB.NET
environment (formatcurrency and formatpercent).

There are certain parts of the applicaiton where it makes sense for SQL
Server to calculate some of the numbers and other where it makes sense for
VB.NET to.

Thanks

推荐答案

tmeister写道:
tmeister wrote:

我想我的第一个问题是什么是正确的(确定税或销售价格时)?

I guess my first question is what is correct (when determining Tax or
Sale prices)?




您的会计师/ CFO应该能够告诉您哪种是正确的
会计方法。为什么这个计算留给了

程序员?这是一个财务问题,而非编程问题。


-

David Gugick

Imceda Software
< a rel =nofollowhref =http://www.imceda.comtarget =_ blank> www.imceda.com



Your accountant / CFO should be able to tell you which is the correct
accounting method. Why is this calculation being left to the
programmers? This is a financial matter, not a programming one.

--
David Gugick
Imceda Software
www.imceda.com


tmeister写道:
tmeister wrote:

我想我的第一个问题是什么是正确的(确定税或销售价格时)?

I guess my first question is what is correct (when determining Tax or
Sale prices)?




您的会计师/首席财务官应该能够告诉您哪种是正确的

会计方法。为什么这个计算留给了

程序员?这是一个财务问题,而非编程问题。


-

David Gugick

Imceda Software
< a rel =nofollowhref =http://www.imceda.comtarget =_ blank> www.imceda.com



Your accountant / CFO should be able to tell you which is the correct
accounting method. Why is this calculation being left to the
programmers? This is a financial matter, not a programming one.

--
David Gugick
Imceda Software
www.imceda.com


我意识到这是一个会计问题,但如果我扮演的是每一个角色,那么现在我的决定就是b
。我无法想象这种类型的问题没有得到解决。几乎每个电子商务网站都在互联网上。一旦做出决定,我将需要知道如何在

SQL Server或内部VB.NET上实现相应的功能。

谢谢


" David Gugick"写道:
I realize this is an accountant question, but if I''m playing every role, it''s
now my decision. I can''t imagine that this type of question is not addressed
with almost every ecommerce site on the Internet. Once a decision is made, I
will need to know how to implement the appropriate functionality either on
SQL Server or insided VB.NET.

Thanks

"David Gugick" wrote:
tmeister写道:
tmeister wrote:

我想我的第一个问题是什么是正确的(确定税或销售价格时) ?

I guess my first question is what is correct (when determining Tax or
Sale prices)?



您的会计师/首席财务官应该能够告诉您哪种会计方法正确。为什么这个计算留给了程序员呢?这是一个财务问题,而不是编程问题。

-
David Gugick
Imceda Software
www.imceda.com



这篇关于Math.Round和SQL Server Round的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆