Copy Code Trigger Definition

                 
    create trigger TR_REGISTRANT_TASYNC_I on dbo.REGISTRANT after insert not for replication
    as begin
      -- Excluding the normal condition that the insert is not performed by the sync.

      -- This table is mapped B2T to a different table than the original TA table, and this needs to behave

      -- in the same manner whether the row comes from TA or BBEC originally.

      
      insert into dbo.TA_REGISTRANT (ID, SYNCID, ACTIONCODE)
      select ID, newid(), 1
      from INSERTED
        where GUESTOFREGISTRANTID is null

      -- note that the above insert could fail if row is deleted and then reinserted w/ same ID before sync is run

      -- since we would not know anything about whether the row is really the same or not, we need to throw an exception

      -- to resolve, run the sync, then retry the insert

    end