Back to OIM Explorer

dbo.TSB_TUUNSAccountBHasUNSGroupB2

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on UNSAccountBHasUNSGroupB2. Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 6; Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 6; Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 6; Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 6

Source: sandbox-db sys.sql_modules

Source size: 3.290 characters

Interpretation

  • Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Relations

  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 6
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 6
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 6
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 6
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 11
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 11
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 11
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 16
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 16
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 20
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: UNSAccountBHasUNSGroupB2

Typed Edges

  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 6 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 6
  • queues DBQueue task TSB_ZPersonHasObject at line 6 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 6
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 6 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 6
  • queues DBQueue task TSB_ZPersonHasObject at line 11 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 11
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 11 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 11
  • queues DBQueue task TSB_ZPersonHasObject at line 16 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 16
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 16 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 16
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 20 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 20
  • trigger on table UNSAccountBHasUNSGroupB2 Trigger parent table: UNSAccountBHasUNSGroupB2
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_FGIXOriginChanged_Effect source text reference
  • references source dbo.QBM_FGIXOriginChanged_Except2 source text reference
  • references source dbo.QER_FCVXOriginToInheritInfo source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.TSB_TUUNSAccountB source text reference
  • references source dbo.TSB_TUUNSAccountBHasUNSGroupB source text reference

Complete Source

SQL137 lines
1CREATE trigger TSB_TUUNSAccountBHasUNSGroupB22  ON UNSAccountBHasUNSGroupB2 FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @GenProcID varchar(38)7  DECLARE @XUser nvarchar(64)8  BEGIN TRY9    IF EXISTS(10      SELECT TOP 1 111      FROM inserted)12    GOTO start13    IF EXISTS(14      SELECT TOP 1 115      FROM deleted)16    GOTO start17    RETURN start:18    SELECT @GenProcID = dbo.QBM_FGISessionContext('')19    SELECT @XUser = dbo.QBM_FGISessionContext('XUser')20    IF21    UPDATE(XOrigin) OR22    UPDATE(XIsInEffect)23    BEGIN24      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw25      INSERT INTO @DBQueueElements_01(object,26      subobject,27      genprocid)28      SELECT29        x.uid,30        NULL,31        @GenProcID32      FROM(33      SELECT34        DISTINCT d.UID_UNSAccountB AS uid35      FROM deleted d36      JOIN UNSAccountBHasUNSGroupB2 dd37        ON d.XObjectKey = dd.XObjectKey38      WHERE39        dbo.QBM_FGIXOriginChanged_Except2(d.XOrigin, dd.XOrigin) = 1 OR(d.XIsInEffect <> dd.XIsInEffect AND dbo.QBM_FGISessionContext('Fullsync'40      ) > ' ')) AS x41      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB2',42        @DBQueueElements_0143    END44    IF45    UPDATE(XIsInEffect) OR46    UPDATE(XOrigin)47    BEGIN48      DECLARE @DBQueueElements_02 QBM_YDBQueueRaw49      INSERT INTO @DBQueueElements_02(object,50      subobject,51      genprocid)52      SELECT53        x.uid,54        NULL,55        @GenProcID56      FROM(57      SELECT58        DISTINCT x.UID_Person AS uid59      FROM UNSAccountBHasUNSGroupB2 a60      JOIN deleted d61        ON a.XObjectKey = d.XObjectKey62      JOIN UNSAccountB x63        ON a.UID_UNSAccountB = x.UID_UNSAccountB64      WHERE65        x.UID_Person > ' ' AND(dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 OR dbo.QER_FCVXOriginToInheritInfo66      (d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(a.XOrigin))) AS x67      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject',68        @DBQueueElements_0269      IF '1' = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\IncludeTSBPersonUsesAccount')70      BEGIN71        DECLARE @DBQueueElements_PersonUsesAccount QBM_YDBQueueRaw72        INSERT INTO @DBQueueElements_PersonUsesAccount(object,73        subobject,74        genprocid)75        SELECT76          x.uid,77          NULL,78          @GenProcID79        FROM(80        SELECT81          DISTINCT t.uid_person AS uid82        FROM UNSAccountBHasUNSGroupB2 aig83        JOIN deleted d84          ON aig.XObjectKey = d.XObjectKey85        JOIN UNSAccountB a86          ON aig.UID_UNSAccountB = a.UID_UNSAccountB87        JOIN TSBPersonUsesAccount t88          ON a.XObjectKey = t.ObjectKeyAccount89        WHERE90          (dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, aig.XOrigin, d.XIsInEffect, aig.XIsInEffect) = 1 OR dbo.QER_FCVXOriginToInheritInfo(d.XOrigin91        ) <> dbo.QER_FCVXOriginToInheritInfo(aig.XOrigin))) AS x92        EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject',93          @DBQueueElements_PersonUsesAccount94      END95      IF 'UNSGroupB2' = 'UNSGroupB'96      BEGIN97        IF EXISTS(98          SELECT TOP 1 199          FROM UNSItemB)100        BEGIN101          DECLARE @DBQueueElements_03 QBM_YDBQueueRaw102          INSERT INTO @DBQueueElements_03(object,103          subobject,104          genprocid)105          SELECT106            x.uid,107            NULL,108            @GenProcID109          FROM(110          SELECT111            DISTINCT d.UID_UNSAccountB AS uid112          FROM UNSAccountBHasUNSGroupB2 a113          JOIN deleted d114            ON a.XObjectKey = d.XObjectKey AND dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect,115          a.XIsInEffect) = 1116          WHERE117            EXISTS(118          SELECT TOP 1 1119          FROM UNSAccountB acc120          JOIN UNSItemB b121            ON acc.UID_UNSRootB = b.UID_UNSRootB AND acc.UID_UNSAccountB = a.UID_UNSAccountB)) AS x122          EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBHasUNSItemB',123            @DBQueueElements_03124        END125      END126    END127  END TRY128  BEGIN CATCH129    EXEC QBM_PSessionErrorAdd DEFAULT130    RAISERROR('',131    18,132    1)133      WITH NOWAIT134  END CATCH135  ende:136  RETURN137END
Open raw exported source
SQL ยท Raw22 lines
1create   trigger TSB_TUUNSAccountBHasUNSGroupB2 on UNSAccountBHasUNSGroupB2  for Update not for Replication as begin  declare @GenProcID varchar2(38) declare @XUser nvarchar(64) BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return3 start: select @GenProcID = dbo.QBM_FGISessionContext('') select @XUser = dbo.QBM_FGISessionContext('XUser') if update(XOrigin) or update(XIsInEffect) 4begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( 5select distinct d.UID_UNSAccountB as uid from deleted d join UNSAccountBHasUNSGroupB2 dd on d.XObjectKey = dd.XObjectKey where dbo.QBM_FGIXOriginChanged_Except26(d.XOrigin, dd.XOrigin) = 1  or (d.XIsInEffect <> dd.XIsInEffect and dbo.QBM_FGISessionContext ('Fullsync') > ' ' ) ) as x exec QBM_PDBQueueInsert_Bulk7 'TSB-K-UNSAccountBInUNSGroupB2', @DBQueueElements_01 end  if update(XIsInEffect) or update(XOrigin) begin declare @DBQueueElements_02 QBM_YDBQueueRaw8 insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct x.UID_Person as uid from UNSAccountBHasUNSGroupB29 a join deleted d on a.XObjectKey = d.XObjectKey join UNSAccountB x on a.UID_UNSAccountB = x.UID_UNSAccountB where x.UID_Person > ' ' and ( dbo.QBM_FGIXOriginChanged_Effect10(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 or dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(a.XOrigin) ) 11) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject', @DBQueueElements_02  if '1' = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\IncludeTSBPersonUsesAccount'12) begin declare @DBQueueElements_PersonUsesAccount QBM_YDBQueueRaw insert into @DBQueueElements_PersonUsesAccount (object, subobject, genprocid) select13 x.uid, null, @GenProcID from ( select distinct t.uid_person as uid from UNSAccountBHasUNSGroupB2 aig join deleted d on aig.XObjectKey = d.XObjectKey14 join UNSAccountB a on aig.UID_UNSAccountB = a.UID_UNSAccountB join TSBPersonUsesAccount t on a.XObjectKey = t.ObjectKeyAccount where ( dbo.QBM_FGIXOriginChanged_Effect15(d.XOrigin, aig.XOrigin, d.XIsInEffect, aig.XIsInEffect) = 1 or dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(aig.XOrigin16) ) ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject', @DBQueueElements_PersonUsesAccount end  if 'UNSGroupB2' = 'UNSGroupB'  begin if exists17 (select top 1 1 from UNSItemB ) begin declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select18 x.uid, null, @GenProcID from ( select distinct d.UID_UNSAccountB as uid from UNSAccountBHasUNSGroupB2 a join deleted d on a.XObjectKey = d.XObjectKey19 and dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 where exists (select top 1 1 from UNSAccountB acc join UNSItemB20 b on acc.UID_UNSRootB = b.UID_UNSRootB and acc.UID_UNSAccountB = a.UID_UNSAccountB) ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBHasUNSItemB'21, @DBQueueElements_03 end end end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 22