Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
DECLARE @CalculatedHours AS REAL
SET @CalculatedHours=(((06*60)+36))/60
SELECT @CalculatedHours


I want it as 6.6 but am getting the answer as 6

I tried using but still am getting the answer as 6
SQL
DECLARE @CalculatedHours AS DECIMAL(2,1)
SET @CalculatedHours=(((06*60)+36))/60
SELECT @CalculatedHours
Posted
Comments
maya.r.shobana 26-Nov-14 3:03am    
Thankyou Avijnata and praneet it helped me out
[no name] 26-Nov-14 3:43am    
I am glad it worked for you !! :)

Try giving the denominator as 60.0 instead of 60
 
Share this answer
 
You are using Real or decimals, hence in
SQL
SET @CalculatedHours=(((06*60)+36))/60

Make any number to one decimals. Like, 06.0 or 60.0 or 36.0 to get your output

Otherwise implicit casting will be done to integer.

Regards.
Praneet
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900