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)
 cursor with the name cur_m already exists

Author  Topic 

DURGESH
Posting Yak Master

105 Posts

Posted - 2008-10-17 : 01:31:04
i have declared a cursor cur_m dynamically,
when i am executing the code i am getting the following error

Server: Msg 16915, Level 16, State 1, Line 1
A cursor with the name 'CUR_M' already exists.

what could be the problem
Help me out to solve this issue

Durgesh J

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-17 : 02:15:30
The problem is that you

1) Use dynamic SQL
2) Use cursor in dynamic SQL



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-10-17 : 07:58:40
If code inside your cursor fails such that execution is halted then you need to highlight and run the part of your code that CLOSEs and DEALOCATEs your cursor before trying to run the whold thing again.

EDIT:
or perhaps you have a logic problem where control of flow statements bypass the CLOSE/DEALOCATE.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -