开发者

Converting an int representing number of cents to money

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜