开发者

Convert int to truncated decimal

开发者 https://www.devze.com 2023-02-16 15:08 出处:网络
How do I convert 51501319 to 51.5开发者_StackOverflow中文版? (needs to round to .5) Thanks!Select Round( 51501319 / 1000000.000, 1 )

How do I convert 51501319 to 51.5开发者_StackOverflow中文版? (needs to round to .5)

Thanks!


Select Round( 51501319 / 1000000.000, 1 )


Try this:

SELECT CAST( CAST(51501319 AS decimal(10,1)) / 1000000  AS decimal(10,1))


SELECT ROUND( (1.0*5150319)/100000, 1)

This will get 51.5 but is this really what you want? What should it do with 5159999? Do you want 51.5 or 51.6, or 52.0?

0

精彩评论

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