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
 Transact-SQL (2000)
 Maximum score sans iteration

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-07-06 : 11:54:31
Flinky Wisty Pomm writes "D'oh!

Use an inline UDF which selects all answers into a temp table with a continuous identity and then selects * where id <= @iNumAnswers

Then you have

SELECT SUM(dbo.udfFetchMaxQuestionScore(pk_question_id))
FROM tblQuestions
WHERE fk_form_id = @Form

Does that count?"

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-07-06 : 12:01:57
Im sure it could, but it you might still be able to find a faster method...

in my experiece, using a function can be slow as you have to repeatedly call and execute other code...

but if you're happy with it... congrats!

Corey
Go to Top of Page
   

- Advertisement -