一列height是我的SQL Server表中的整数类型。我想进行除法,并在查询中将结果作为小数:
height
Select (height/10) as HeightDecimal
我如何转换以使HeightDecimal不再是整数?谢谢。
HeightDecimal
SELECT height/10.0 AS HeightDecimal FROM dbo.whatever;
如果要特定的精度标尺,请说:
SELECT CONVERT(DECIMAL(16,4), height/10.0) AS HeightDecimal FROM dbo.whatever;