从存储过程返回值

Nei*_*ir0 0 sql t-sql stored-procedures

我有一个这样的存储过程:

Select @totalMoney*@bonusPercent/100 
Run Code Online (Sandbox Code Playgroud)

我如何从程序返回值并将其分配给变量?我的意思是:

SET @myVarible = EXEC MyStoredProcedure @param1, @param1;
Run Code Online (Sandbox Code Playgroud)

SQL*_*ace 7

使用output变量,return仅适用于整数

create procedure prTest @id int, @id2 decimal(20,10) output
as
select @id2 = @id + 1
go
Run Code Online (Sandbox Code Playgroud)

现在这样称呼它

declare @Test decimal(20,10)


exec prTest 5,@Test output
select @Test
Run Code Online (Sandbox Code Playgroud)

输出
6.00000000