Create Trigger ?

  • Dear All,

    I am trying to create a trigger using the following scenario:

    Table A:

    Field A1, Field A2, Field A3, Field A4

    Table B:

    Field B1, Field B2, Field B3

    On Update (ONLY) of Field A1 I need to insert a record in Table B using values from the updated record in Table A.

    Please help.  This is my first trigger and the help in BOL did not really help me.

    Thanks & Regards,

    Andreas

  • CREATE TRIGGER [trTableA_Update] ON [dbo].[tableA]

    FOR UPDATE

    AS

    SET NOCOUNT ON

    If Update (ColName_That_Causes_Audit)

    begin

    Insert into TableB (Field1, Field2...) Select Field1, Field2... from Inserted

    end

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

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