我为除法创建了一个简单的存储过程。当我运行它时,即使它们是小数,它也会对数字进行四舍五入。例如,5.0/10.0=1
. 为什么这样做?
这是脚本:
GO
CREATE PROCEDURE uspDivide2Numbers2
@intValue1 AS DECIMAL
,@intValue2 AS DECIMAL
AS
SET NOCOUNT ON --Report only errors
DECLARE @intResult AS DECIMAL = 0
--Do calculation
SELECT @intResult = @intValue1 / @intValue2
--Display results
SELECT @intResult AS intResult
GO
uspDivide2Numbers2 5.0, 10.0
谢谢