Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    3

    Unanswered: @@fetch_status in trigger

    in the trigger for update and insert i have the following cursor

    declare crs cursor static local for
    SELECT [id] FROM inserted

    open crs
    fetch next from crs into @v1

    print @@fetch_status

    while @@fetch_status = 0
    begin
    print @v1

    fetch next from crs into @v1
    end

    close crs
    deallocate crs


    the problem is that the @@fetch_status is now always -1 and I'm pretty sure that it worked some time ago and i can't figure what is changed.

    any ideas ?
    thnx.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Why would you want to do this? What's the real trigger look like?

    Can you post that code?

    A cursor in a trigger would more than likely perform poorly...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Dec 2003
    Posts
    3
    I use cursor in trigger cause i can have inserts/updates from multiple sources and i don't want to break the logic.

    code in attach
    Attached Files Attached Files

  4. #4
    Join Date
    Dec 2003
    Posts
    3
    fixed.

    cursor threshold was 0; changed to -1

Posting Permissions

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