开发者

DB2 Implied Decimal

Running DB2 8.2 Fixpak 18 for LUW, I need to convert a DECIMAL field to a IMPLIEDDECIMAL for a file export.

I cannot find anythin开发者_运维问答g in the documentation online, please help.


Just multiply the value of the column by 10^scale of the decimal column and convert it to an integer. So, for a DECIMAL(12,4) column: 10^4 = 10000, and:

cast(yourcol * 10000 as bigint)

If a row has a value of 3.1415, this will result in 31415.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜