RETURN - inside a trigger

  • Hi,

    create trigger dbo.trgMyTable_OnInsertUpdate on MyTable

    FOR UPDATE,INSERT AS

    --========Perform something========

    BEGIN

    --code

    END

    IF not UPDATE(someColumn)

    RETURN

    --=========SQL statements continues=======

    BEGIN

    --code

    END

    suppose "someColumn" is not updated

    in this case, will the SQL statements after IF condtion executes or not?

    Thanks,

    KB

    Thanks,
    Santhosh


    Human Knowledge Belongs To The World !!

  • Why don't you state that:

    IF UPDATE(someColumn)

    BEGIN

    --code

    END

    This will only process if your desired column gets updated.

    Eli

  • Regardless of how you code it, I think you will find that the Return keyword should exit a Trigger / Procedure unconditionally.

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

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