Keeps returning zeros for decimal

Database
N/A

Keeps returning zeros for decimal

Casting as decimal with precision 2, keeps returning 00 after the decimal. How do I actually return values?

column1   hourlycolumn1

----------   ------------------

9797       163.00

358         5.00

265         4.00


select top 10

column1,cast(column1/60 as decimal(6,2)) as "hourlycolumn1"

from 

....


What I would like to return is below

column1   hourlycolumn1

----------   ------------------

9797       163.28

358         5.96

265         4.41


Tags (1)
1 REPLY
Teradata Employee

Re: Keeps returning zeros for decimal

60 is an integer and when column1 is also an integer, integer division is performed which does not result in any fractional portion. Using 60. or casting either column1 or 60 to decimal will resolve the issue.