Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    38

    Unanswered: looping through recordset

    hello,

    i have a select query that returns multiple rows (within a cursor). How do i loop through the rows to process it (in a stored proc)? I donot want to use nested cursors. a code sample is requested.

    thanks!

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Usually a cursor is created to process multiple rows (unless you developed a passion for cursors and would like to create one for 1 row).

    Have you looked at FETCH NEXT?
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Jan 2004
    Posts
    38
    Well, the situation is somethin like this. I am using a cursor that returns multiple rows, within the while @@FETCH_STATUS = 0, I have another sql select that returns multiple rows for every row the cursor is processing. I would want to process every row returned in the inner select query. Do I have an option other than using nested cursors? Any help is appreciated.

  4. #4
    Join Date
    Jul 2004
    Posts
    52
    If you post the code maybe we can get rid of the cursor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •