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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic to static cursors

Author  Topic 

hadoft
Starting Member

20 Posts

Posted - 2005-07-20 : 06:40:28
hi

some times I need to declare a KeySet(or Dynamic) cursor, to make it sensitive to the rows updates while looping.
-the updates are done in the loop by seprate upadte statments not using (current of )-

but according to the cursor SELECT STATMENT, it may be implicitily converted into a STATIC cursor, so it will not fetch the updated version of the data

is there any way to detect that this conversion has happened?
and how to discover the final mode of the cursor? , is it realy KeySet or it has been converted implicitily into STATIC

@@error didn't give any help

thanks.



robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-07-20 : 08:21:06
Well, since you're using a separate UPDATE already, why not get rid of the cursor entirely?
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-07-20 : 10:31:57
The vast majority of cursor implementations are not necessary. The objectives can almost always be accomplished with set based processing. (probably what Rob is implying)

However, assuming you're committed to processing your records one at a time and are concerned that your cursor is not dynamic, a while loop (rather than a cursor) should solve that issue.
select current values for each loop iteration. It will also relieve possible locking issues caused by your cursor.

Be One with the Optimizer
TG
Go to Top of Page

hadoft
Starting Member

20 Posts

Posted - 2005-07-20 : 12:02:56
thanks for the suggestions

but is there an answer to my initial question

is there is any way to know that this cursor is working as STATIC instead of DYNAMIC
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-07-20 : 22:43:09
No, and if you get rid of the cursor, the question becomes moot.
Go to Top of Page
   

- Advertisement -