SQLScientist.com
Pages
Home
About Me
Contact Us
Portfolio
SQL Server Interview Questions
Friday, March 13, 2015
Write recursive t-sql code to get Factorial of integer number
Create
Function
dbo
.
fn_Factorial
(
@v_Number
bigint
)
Returns
bigint
as
Begin
If
(
@v_Number
!=
1
)
go
Select
dbo
.
fn_Factorial
(
6
)
Begin
return
@v_Number
*
dbo
.
fn_Factorial
(
@v_Number
-
1
)
End
return
1
End
go
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment