Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002

    Unanswered: insert/update trigger

    Tbl1 inserts 1 record(with some fields populated) in tbl2. then I need get values from tbl3 to populate the rest of the fields in tbl2(update the record).
    tbl1 = tblallBag_data
    tbl2 = tblBag_data
    tbl3 = tblShipping_sched

    I created a trigger in tbl1 to insert a record into tbl2 and it works fine.

    CREATE TRIGGER trgtblBag_Data ON dbo.tbltblallBag_data

    INSERT INTO tblBag_data (work_ord_num, work_ord_line_num, bag_num, bag_scanned_by, bag_date_scanned, bag_quantity)
    SELECT work_ord_num, work_ord_line_num, bag_num, bag_scanned_by, bag_date_scanned, bag_quantity
    FROM inserted

    How can I update tbl2?
    Should I create another trigger to update tbl2?
    Should I join the two tbls(tbl2 & tbl3) to find
    @work_ord_num = work_ord_num , @work_ord_line_num = work_ord_line_num

    Thanks for your help!

  2. #2
    Join Date
    Jul 2003
    San Antonio, TX
    tbl2 and tbl3 should be joined with inserted.

Posting Permissions

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