Help with a Trigger!

  • I just accomplished my first trigger! No problem getting it to work, however I do seem to get an error every time I try to make a change to the table from within my software that accesses the database. Here is the trigger:

    CREATE TRIGGER UpdatePreqBrand_trigger ON PO_PREQ_LIN

    AFTER INSERT

    AS

    BEGIN

    update PO_PREQ_LIN

    set PO_PREQ_LIN.COMMNT_1 = IM_ITEM.ADDL_DESCR_2

    from PO_PREQ_LIN, IM_ITEM

    where PO_PREQ_LIN.ITEM_NO = IM_ITEM.ITEM_NO and PREQ_NO IN (SELECT PREQ_NO FROM INSERTED);

    END;

    And the error I get when I try to make any changes (e.g. deleting an item):

    Row cannot be located for updating. Some values may have been changed since it was last read

    [Insert]

    [SELECT * FROM [PO_PREQ_LIN] WHERE (1=0) ]

  • Can you post the table structures and some sample data so we can test against your schema?

    Is there anything else going on in the transaction?

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

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