Home Cast everything for 2 decimal points?
Reply: 0

Cast everything for 2 decimal points?

user345
1#
user345 Published in July 22, 2018, 6:19 pm

I want to divide two integers: 8/15 and return "53.33".

I've tried every single combination, and I've found that this is the only way I can return the desired value:

select cast(100*cast(8/cast(15 as decimal(10,4)) as decimal(18,4)) as decimal(18,2))

Is there a shorter way?

Thanks.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.314341 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO