Professional Web Applications Themes

error using cursor - Microsoft SQL / MS SQL Server

Removed by Administrator...

  1. Moderated Post

    Default error using cursor

    Removed by Administrator
    JohnB Guest
    Moderated Post

  2. #2

    Default Re: error using cursor

    Oh, saw this mistake and corrected it, but made no difference:

    "JohnB" <rr.com> wrote in message news:...
     

    should have been

    begin
    update #tranlist set calcDate = prevDate where current of row
    update #tranlist set calcType = prevType where current of row
    end

    cya

    John


    JohnB Guest

  3. #3

    Default Re: error using cursor

    Without a clean repro it is hard to pinpoint exactly what is happening.
    However the error message give some clue. How is this cursor declared? Most
    likely when you have a DECLARE CURSOR statement with OPTIMISTIC option and
    some connections update the row after the cursor fetched a row, the update
    will fail. If you can, change the DECLARE statement to remove this option.
    For pessimistic concurrency control, you can use the option SCROLL LOCKS in
    which the underlying database rows are locked at the time they are read into
    the cursor result set. For more details, refer to the topic concurrency
    architecture in SQL Server Books Online.

    --
    - Anith
    ( Please reply to newsgroups only )


    Anith Guest

  4. #4

    Default Re: error using cursor

    Hi Anith

    Thanks for the reply. I wasn't thinking about changing the cursor
    declaration, so you've given me something to check out. Here is my current
    cursor declaration. I went with the simpler ANSI declaration syntax, but
    I'll try using the full TSQL syntax, it may just be the problem.

    declare row scroll cursor for
    select * from #tranlist
    order by trandate desc, trantype
    for update of calcRow, calcDate, calcAmount, calcType

    thanks

    John

    in reply to:
    "Anith Sen" <com> wrote in message
    news:phx.gbl... 
    Most 
    in 
    into 


    JohnB Guest

  5. #5

    Default Re: error using cursor

    Anith

    Thanks for the tip about the cursor declaration. That turned out to resolve
    the issue. I changed my cursor declaration to the following:

    declare row cursor local scroll keyset scroll_locks for
    select * from #tranlist
    order by trandate desc, trantype
    for update of calcRow, calcDate, calcAmount, calcType

    Amazingly enough, that resolved the problem.

    thanks

    John

    in reply to:
    "Anith Sen" <com> wrote in message
    news:phx.gbl... 
    in 
    into 


    JohnB Guest

Similar Threads

  1. cursor already in use error
    By Sim in forum PostgreSQL / PGSQL
    Replies: 6
    Last Post: March 2nd, 10:03 AM
  2. cursor 200-problem on mac but not pc? how to swap cursor image?
    By nickelsock webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 5
    Last Post: August 2nd, 10:58 AM
  3. error: Incorrect database or cursor name format
    By Philipp Walderdorff in forum Informix
    Replies: 2
    Last Post: July 27th, 04:38 AM
  4. Replies: 0
    Last Post: July 16th, 07:00 AM
  5. Replies: 0
    Last Post: July 16th, 04:09 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139