positioned update problem

  • I get the following error when executing the code listed below. Any ideas what I'm doing wrong?

    Server: Msg 16947, Level 10, State 1, Line 1093055397

    No rows were updated or deleted.

    The statement has been terminated.

    (0 row(s) affected)

    declare @d1 char(1)

    declare cur1 cursor for

    select col1 from tab1 where col2 = 1

    open cur1

    fetch next from cur1 into @d1

    update tab1 set col1 = '1' where current of cur1

    deallocate cur1

    any help please

  • That message means you are trying to update a view that joins to at least one other table.

    I assume in your code that "tab1" is actually a view.

    What are you trying to achieve... from the code you've given, it doesn't look like you need to use a cursor anyway.

  • Just as an aside to that , on the few occasions that ive used 'where current of' ive found it to be pretty poorly performing.



    Clear Sky SQL
    My Blog[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply