大家好,请帮我从下面的计算部分获得真正的价值 [英] Hi all please help me for getting real value from the below calculation part

查看:39
本文介绍了大家好,请帮我从下面的计算部分获得真正的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DECLARE @CalculatedHours AS REAL
SET @CalculatedHours=(((06*60)+36))/60
SELECT @CalculatedHours





我希望它为6.6但我得到答案为6



我试过用但仍然得到答案为6



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

I tried using but still am getting the answer as 6

DECLARE @CalculatedHours AS DECIMAL(2,1)
SET @CalculatedHours=(((06*60)+36))/60
SELECT @CalculatedHours

推荐答案

尝试将分母设为60.0而不是60
Try giving the denominator as 60.0 instead of 60


您使用的是实数或小数,因此在

You are using Real or decimals, hence in
SET @CalculatedHours=(((06*60)+36))/60



将任意数字设为一位小数。比如,06.0或60.0或36.0来获得你的输出



否则隐式转换将完成整数。



问候。

Praneet


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


这篇关于大家好,请帮我从下面的计算部分获得真正的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆