Transact-SQL Loses decimals on divide

Hello,

Why, does 15 / 60 return 0?  For example, in transact-sql, if I execute the query

print 15 / 60

SQL returns 0 instead of 0.25.

I guess it is assuming an Integer datatype for some reason.... how could I fix that?

Thanks!
quiTechAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jdlambert1Connect With a Mentor Commented:
You need to make the numerator a decimal:

DECLARE @num1 decimal(10,5)
SET @num1 = 15
SELECT @num1 / 60
0
 
quiTechAuthor Commented:
Works great!  Thanks!
0
All Courses

From novice to tech pro — start learning today.