trigger script

  • I'm developing in MS SQL Server 7.0 environment.

    This is the script for the trigger:

    CREATE TRIGGER trgtblBag_data ON tblDelete_Inventory

    FOR DELETE

    AS

    Declare @work_ord_num char;

    SELECT @work_ord_num = work_ord_num

    FROM tblDelete_Inventory

    DELETE tblBag_data

    WHERE @work_ord_num = work_ord_num

    Thanks!

  • I think what you really want is to query the "deleted" table rather than the actual table.

    IE:

    
    
    CREATE TRIGGER trgtblBag_data ON tblDelete_Inventory
    FOR DELETE
    AS

    DELETE t
    FROM tblBag_Data BD
    JOIN deleted d ON BD.work_ord_num = d.work_ord_num

    RETURN

    Gary Johnson

    Microsoft Natural Language Group

    DBA, Sr. DB Engineer




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

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

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