On Insert Trigger Joining Another Table

  • I am trying to write a trigger that does the following:

    When a record is inserted into ARTRAN then ARTRAN.TRANDESC is updated based on data from another table.

    Here is what I have so far but it isn't firing.

    UPDATE dbo.ARTran

    SET TRANDESC = LEFT(S.Descr, 30)

    FROM dbo.ARTran A

    JOIN SOLINE S ON A.shipperid = S.shipperid and A.shipperlineref = S.lineref

    JOIN INSERTED I ON A.shipperid = I.shipperid and a.shipperlineref = i.shipperlineref

    WHERE A.shipperid <> '' and a.trandesc <> 'Trade Discount'

    The join to SOLINE is correct even though the field names aren't the same.

    Can someone tell me what I am missing?

  • I'm sorry. I figured it out. The trigger was an After Update instead of After Insert. Duh!

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

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