开发者

DB2 Implied Decimal

开发者 https://www.devze.com 2023-01-08 14:35 出处:网络
Running DB2 8.2 Fixpak 18 for LUW, I need to convert a DECIMAL field to a IMPLIEDDECIMAL for a file export.

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

精彩评论

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

关注公众号