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 |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2008-12-16 : 16:29:40
|
| How can i accumulate all the records from the for next loop....I have the following:DECLARE @CUR_TEMP CURSORSET @CUR_TEMP = CURSOR SCROLL FOR (select distinct(element_id) from tab_ccsnetelementcontracts where contractid=@contractid)OPEN @CUR_TEMPFETCH FIRST FROM @CUR_TEMP INTO @ElementID select efund_id,fundid,efund_amt,element_id from Tab_ccsNetEfund where element_id=@element_idFETCH NEXT FROM @CUR_TEMP INTO @ElementIDIf the loop goes 5 times, then all of the records from each loop i want to push to the front end.Example: if the loop goes 5 times, each iteration if it gets 5 records, then i would like to show 25 records on the front end.Thank you very much for your help. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-16 : 23:39:49
|
| Can i ask the purpose of cursor here? If you can explain what you're trying to do, we can see if there's any set based alternative soln. |
 |
|
|
|
|
|
|
|