Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 factorial

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-07 : 09:23:14
yaniv writes "Hi
I have a question from a test
having a table with a single column "VALUE" and 5 rows values 1-5,
i need a query(not a procedure) which return factorial of 5 (5!)
thanks in advance
yaniv"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-11-07 : 09:55:36
How about ...

declare @i int

select
@i = coalesce(@i,1) * n
from
numbers
where
n <= 5

select @i





Mark-up SQLTeam posts here
http://www.markitup.com/Forum/SQLTeam.asp

Jay White
{0}
Go to Top of Page
   

- Advertisement -