开发者

Converting an int representing number of cents to money

开发者 https://www.devze.com 2022-12-08 22:34 出处:网络
Like this question, except T-SQL instead of php. 206275947 = 2062759.47 etc. The problem I\'m running into is that an attempt to SUM the values in this column is overflowing the integer datatype in

Like this question, except T-SQL instead of php.

206275947 = 2062759.47

etc.

The problem I'm running into is that an attempt to SUM the values in this column is overflowing the integer datatype in S开发者_JAVA技巧QL.

SUM(CONVERT(money,[PaymentInCentsAmt]))

Is just tacking on ".00" to the end of the value. What obvious thing am I missing?


how about use money/100?


If you are counting money and especially if youare getting overflows you should try making variables and columns as type decimal that allows as much significance as the calcualations need

0

精彩评论

暂无评论...
验证码 换一张
取 消