In this tutorial we will write “Stored Procedure” calculates the factorial of a number. That is specified at below.
Create procedure factor(@number int)
Declare @i int = 1,@result int=1
Set @result = @result * @i
Set @i += 1
You must execute the code ebove and get succesful message. Then By running the following code, you can calculate the factorial of the number you want.
Execute factor 5