存储过程返回.00十进制

shm*_*dor 3 sql t-sql sql-server sql-server-2005

此存储过程不返回小数格式为00.00的工资

ALTER PROCEDURE taxable_varsalary

@emp_code bigint,
@co_id bigint      

AS
declare @t_varsalary decimal(8,2)

set @t_varsalary  = (select sum(tran_value) from emp_ded_ben_trans where emp_code=@emp_code and co_id=@co_id and period_flg=2 and tax_flg=0)

RETURN @t_varsalary 
Run Code Online (Sandbox Code Playgroud)

Mar*_*ith 5

ALTER PROCEDURE taxable_varsalary

 @emp_code bigint,
 @co_id bigint,
 @t_varsalary decimal(8,2) OUTPUT

AS

   select @t_varsalary  = sum(tran_value) 
   from emp_ded_ben_trans 
   where emp_code=@emp_code and co_id=@co_id and period_flg=2 and tax_flg=0
Run Code Online (Sandbox Code Playgroud)

存储过程的返回值必须是int.使用输出参数,而不是或select