August 28, 2007 at 8:18 am
Help appreciated:
I open up a cursor to a [large table]. I have to run through each record , do some math on some of the fields based on entries in other fields yada yada.
Then I open up a cursor to a [main table] where all the info is stored. I pull up a matching record based on a number (serial number ) then make some more calculations and then finally store the results in the [main table] using the current cursor position.
I then close the cursor, deallocate then loop back to the beginning of the procedure to fetch the next record in the [large table] open the cursor to the [main table] etc etc.
Question: Should I use a Select and Update rather than a FETCH and UPDATE (speed being of biggest importance)
Thanks in advance
James
August 28, 2007 at 8:28 am
I would guess select into would be much faster than fetching
August 28, 2007 at 10:28 am
Show us the code, and we might help you rewrite it SET-based.
N 56°04'39.16"
E 12°55'05.25"
August 28, 2007 at 3:59 pm
Nested cursors on large tables, awesome!! If speed is your concern, scrap the cursors. I agree with Peter, post your code and work towards creating a SET-based solution.
August 28, 2007 at 6:24 pm
August 28, 2007 at 10:50 pm
Well, what say thee, James... I see at least 3 people that really wanna help you fix this... all you need to do is post the offending code.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 29, 2007 at 6:41 am
I got a co-worker to walk me through the code but greatly appreciate the offer for help. sorry for the late reply I got tied up the rest of the afternoon.
People prob don't say it enough but the posters on here are awesome (this excludes the bashers that eat people up for not replying back to a post the same minute)
August 31, 2007 at 9:47 pm
You feel "bashed" by anything on this thread? Most folks express some urgency when they post a question and your's is likely interesting... All I was doing was showing that I was interested in your problem...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 1, 2007 at 5:51 am
September 1, 2007 at 7:32 am
Heh... yeah... and I'm still wondering why anyone would even use the term "bashing" in relation to what I posted. And I certainly wasn't trying to "eat at" anyone.
So, James, did your compatriot end up using either a Cursor or a While loop to solve your problem? Like I said, I am interested in your problem...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply