November 10, 2008 at 10:16 am
My application is in classic ASP and I need to process the return from a cursor fetch-by-fetch.
Cursor values are returned by a stored procedure. I can put in a temp table and process.
Is there a better way? I want something like this:
DECLARE mycursor
Open mycursor
While (@@fetch_status = 0)
BEGIN
Fetch Next from mycussor
-- some processing /select etc
Return from mycursor with RESUME
Fetch Next
END
Close mycursor
November 10, 2008 at 10:21 am
what is the some processing select stuff?
Depending on what it is you may not need a cursor
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
November 10, 2008 at 10:26 am
The inner processing is a select with conditions.
Is this possible..
November 10, 2008 at 10:35 am
It may be possible to do this without a cursor,
If you post your code , table structres and sample data then I am sure you will get a more complete answer.
November 10, 2008 at 12:39 pm
That is a good suggestion. I converted the inner select/processing to a function and am calling this function in my select statement: no cursor required
November 10, 2008 at 3:27 pm
You may have eliminated the cursor, but you may not have eliminated the RBAR (Modenism for Row By Agonizing Row) processing.
If you post your code, table DDL (create statements), sample data (as insert statements), and expected results; we may be able to find a more effective way to complete the required processing.
Read the article in my signature block for more info on how to best help us help you.
November 10, 2008 at 4:47 pm
chandrika5 (11/10/2008)
That is a good suggestion. I converted the inner select/processing to a function and am calling this function in my select statement: no cursor required
As Lynn stated, you've probably replaced one form of RBAR with another. There's a lot of ways to get around that, but we at least need to see the real code. His instructions for the rest would be even better because we could actually give you a tested example.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply