January 7, 2010 at 8:35 pm
I have a stored procedure with complex query which is using cursors. I know cursors are not good but now I cannot ask developers to change the code as I said the code is too complicated.
Is there a way to debug how the cursor is working or how many times each cursor is fetching the data and what code it is processing?
I tried using profiler, but I am confused of what events to use?
Any help is greatly appreciated.
Thanks
January 7, 2010 at 8:59 pm
Hi,
The Cursors is not always bad, in there is no Option to using other method, that time the programmers uses the Cursors.
And you need to know the no of records the cursors fetches, for this the profiler is not required and not capture this information, because this is dynamic depends on the parameters you passed to the procedures.
And you also refer this link to know more.
January 7, 2010 at 10:13 pm
Can you show us the code?
January 9, 2010 at 6:49 am
Sometimes a cursor is the best solution. Not usually the fastest - but then that's not always the primary consideration.
Aside from Profiler, there is a dynamic management view that you can look at to see information about currently open cursors:
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply