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 2005 Forums
 Transact-SQL (2005)
 @@FETCH_STATUS in Cursor Problem

Author  Topic 

khufiamalik
Posting Yak Master

120 Posts

Posted - 2008-10-16 : 07:25:46
Hello All,
I have a Cursor, and iterating it by a loop with condition @@FETCH_STATUS=0

but the loop is running for unlimited counts

previously the same loop was working fine but when I run another SP which was also using a Cursor and that SP gave me the error then I run this SP it also started giving error.

Can any one help me?????

Thanks in advance.

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-10-16 : 07:47:25
Too many possible problems to guess at a solution.

Please post the code for the cursor, and the stored proc in question.

-------------
Charlie
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-10-16 : 11:09:26
@@FETCH_STATUS is global to all cursors on a connection

To retrieve the last fetch status of a specific cursor, query the fetch_status column of the sys.dm_exec_cursors dynamic management function.

See:
http://msdn.microsoft.com/en-us/library/ms187308.aspx
Go to Top of Page
   

- Advertisement -