I am a beginner in SQL Functions. What is the best way to create a function for factorial in SQL Server- Say 10!
Another way:
create function Fact(@num int) returns bigint as begin declare @i int = 1 while @num>1 begin set @i = @num * @i set @num=@num-1 end return @i end select dbo.Fact(5)