CREATE PROC [dbo].[usp_spFactorial]@InputValue INT,@OuputValue INT OUTPUTASBEGIN 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; ENDEND