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 Problem

Author  Topic 

DrewBurlingame
Starting Member

49 Posts

Posted - 2001-08-22 : 21:05:03
Before I forget, SQL Server 7.0 on NT4.

I've got a requisition system with two main tables, ReqHeader & ReqDetail. I've got two corresponding staging tables that I read my edi files into.

In my sproc, I'm using a cursor to step through each header, modifying data and running other sprocs based on data. Within that cursor, I'm running another cursor for to process the details. I'm sure most of you are cringing right now from the overhead, and I apologize for the pain I'm putting you through. I'm using cursors because I need to call stored procedures to add the header and details to the main req tables, and I need to use those sprocs because they perform other manipulations, and they are the only to sprocs I use to add to those tables, keeping the code in one spot. I'm always open to other ideas though, so feel free to let loose on me. I'm still fairly new at this.

Okay, my problem is that when I run the sproc, I get this error: "The cursor is READ ONLY". On this line, I'm using an update where current... to update that record. And this is my cursor declaration:
DECLARE ReqHeaderCursor CURSOR
GLOBAL
KEYSET
OPTIMISTIC
FOR

After KEYSET & OPTIMISTIC, I don't know what else to try. I even used DYNAMIC with the same results.

Any thoughts? Thanks in advance.

   

- Advertisement -