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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2009-01-18 : 05:18:06
|
| [code]DECLARE sob CURSOR FORselect useritemsboughtid,userid from useritemsbought where closeddate is null and soamount>=5000 OPEN sob FETCH sob INTO @useritemsboughtid, @userid WHILE @@Fetch_Status = 0 BEGIN exec admincalculategain @useritemsboughtid,@userid ENDCLOSE sobDEALLOCATE sobRETURN[/code]this is running an enless loop - what am i doing wrong? |
|
|
xpandre
Posting Yak Master
212 Posts |
Posted - 2009-01-18 : 08:45:56
|
| [code]OPEN sob FETCH sob INTO @useritemsboughtid, @userid WHILE @@Fetch_Status = 0 BEGIN exec admincalculategain @useritemsboughtid,@useridFETCH sob INTO @useritemsboughtid, @userid ENDCLOSE sobDEALLOCATE sobRETURN[/code]else how would @@Fetch_Status = 0 ever go!!!! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-18 : 08:53:18
|
| you're fetching next value from cursor that why...you need a FETCH NEXT at end of loop before closing to get next record value from table.why are you trying to execute procedure for each value row by row? whats the procedure doing? |
 |
|
|
|
|
|