sql 存储过程 递归
CREATE PROC [dbo].[usp_spFactorial] @InputValue INT, @OuputValue INT OUTPUT AS BEGIN DECLARE @InValue INT; DECLARE @OutValue INT; IF(@InputValue!=0) BEGIN SET @InValue = @InputValue - 1; EXEC usp_spFactorial @InValue,@OutValue OUTPUT; SELECT @OuputValue = @InputValue + @OutValue; END ELSE BEGIN SET @OuputValue = 0; END END