任何关于将员工 11 的总工资四舍五入的想法是 10.44,但出于某种原因将其四舍五入为 10,即使他们都设置为小数 (8,2)
ALTER procedure [dbo].[hms_GetEmployeeSallaryByEmpNo]
(
@Id int
)
as
/* lets make our tempory tables */
create table #contracts
(
empno INT,
contract_id INT
)
DECLARE @contract_id int
DECLARE @totalsallary decimal(8,2)
begin
INSERT into #contracts SELECT c.emp_no,c.contract_id
FROM contract c
where c.emp_no = @Id AND c.leave_date='1900-01-01 00:00:00.000'
end
SET @totalsallary =(select SUM(salary)
from #contracts c,salary s
where s.contract_id = c.contract_id)
return @totalsallary