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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-02-26 : 23:07:03
|
Purav writes "Hi,
declare @stdmst_id varchar(14) declare @cnt int declare dd cursor for exec('select b.stdmst_id,count(b.stdmst_id) --doesnt work from '+@TableNameQuestions +' a ,'+@TableNameAnswers +' b where a.QUIZ_QUESTIONID=b.QUIZ_QUESTIONID and a.CORRECT_ANSWER = b.QUIZ_ANSWERGIVEN and b.stdmst_id in (select stdmst_id from '+@TableNameWinners+') group by b.stdmst_id ')
open dd fetch next from dd into @stdmst_id,@cnt while @@fetch_status=0 begin update @TableNameWinners set stdmst_points=stdmst_points+(@cnt*2) where stdmst_id=@stdmst_id fetch next from dd into @stdmst_id,@cnt end close dd deallocate dd
inside a cursor exec(command) doesnt work ...why???" |
|
|
|
|
|