Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2008
    Posts
    3

    Unanswered: Invalid cursor position

    Hi all, I'm new to this forum and also new to SQL Server. I've been working with Oracle for quite sometime now.

    User has reported an error from the application error log:

    SQL Code:|0|SQL Error:|(0) - [Microsoft][ODBC SQL Server Driver]Invalid cursor position|
    Read on MLIST: ||||
    MLIST is a table, I believe the code is reading this table and throwing this error.

    I've requested the application team to provide me with the code.

    But is it possible to get the sql code from the error log?? I tried looking at the SQL Management Studio, the SQL server logs. But the logs only show the Login attempts and not any other information.

    Thank you.

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    wait for the code and then post it here.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Nov 2008
    Posts
    3
    I just looked at the SQL Code on the application side. It is a 50lines code and straightforward, basically does:

    Code:
    select * from mlist where col1= value, col2=value
    execute begin
    insert into slist values ( ) --The record read above is being
    inserted here into this new 
    table slist.
    
    delete from mlist where --The record is deleted in mlist.
    
    commit work;

    -- There are 4000 records in mlist for the where clause condition. But only 2000 records have been inserted into slist. When we close the session and open a new session and run the code, the rest of 2000 records are inserted.

    Could be any resource issue?? Or is it possible to increase number of cursors, if that may be the cause??

    Thanks a lott.

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    Are they using the update methods from the recordset object? If so, then it is likely that a stored procedure would be better moving data between tables in the same database.

  5. #5
    Join Date
    Nov 2008
    Posts
    3
    MCrowley, Thanks for your reply. They are just using a simple insert into the new table. No update statements.

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    can't debug code without code.

    are you properly checking your fetch status?

    are you using the appropriate cursor for the locks on the data you are making. Is it possible some of the record set is being changing while your cursor is churning away?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  7. #7
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    I still smell some sort of ADO Cursor, and not a T-SQL cursor. I am leaning toward someone deleting a row in their recordset, and they are having a problem looking up the vaporized record.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •