Back to OIM Explorer

dbo.TSB_TUUNSAccountBInUNSGroupB

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on UNSAccountBInUNSGroupB. Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 10; Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 10; Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 10; Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 10

Source: sandbox-db sys.sql_modules

Source size: 3.984 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-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 10
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 10
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 10
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 10
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 15
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 15
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 15
  • Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 20
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 20
  • Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 24
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: UNSAccountBInUNSGroupB

Typed Edges

  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 10 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 10
  • queues DBQueue task TSB_ZPersonHasObject at line 10 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 10
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 10 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 10
  • queues DBQueue task TSB_ZPersonHasObject at line 15 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 15
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 15 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 15
  • queues DBQueue task TSB_ZPersonHasObject at line 20 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 20
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 20 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 20
  • queues DBQueue task TSB_ZUNSAccountBHasUNSItemB at line 24 Bulk DBQueue insert -> TSB-K-UNSAccountBHasUNSItemB / TSB_ZUNSAccountBHasUNSItemB at line 24
  • trigger on table UNSAccountBInUNSGroupB Trigger parent table: UNSAccountBInUNSGroupB
  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • 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

Complete Source

SQL158 lines
1CREATE trigger TSB_TUUNSAccountBInUNSGroupB2  ON UNSAccountBInUNSGroupB FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @GenProcID varchar(38)7  DECLARE @XUser nvarchar(64)8  DECLARE @QBM_BitPatternXMarkedForDel_OutStanding int = dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|',9  0)10  BEGIN TRY11    IF EXISTS(12      SELECT TOP 1 113      FROM inserted)14    GOTO start15    IF EXISTS(16      SELECT TOP 1 117      FROM deleted)18    GOTO start19    RETURN start:20    SELECT @GenProcID = dbo.QBM_FGISessionContext('')21    SELECT @XUser = dbo.QBM_FGISessionContext('XUser')22    IF23    UPDATE(XOrigin) OR24    UPDATE(XIsInEffect)25    BEGIN26      IF EXISTS(27        SELECT TOP 1 128        FROM deleted d29        JOIN UNSAccountBInUNSGroupB dd30          ON d.XObjectKey = dd.XObjectKey31        JOIN UNSGroupB g32          ON d.UID_UNSGroupB = g.UID_UNSGroupB33        WHERE34          g.HasReadOnlyMemberships = 1 AND d.XOrigin <> dd.XOrigin AND dbo.QBM_FGISessionContext('Fullsync') = '' AND EXISTS(35      SELECT TOP 1 136      FROM UNSAccountB a37      WHERE38        a.UID_UNSAccountB = d.UID_UNSAccountB AND a.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_OutStanding = 0))39      BEGIN40        RAISERROR('#LDS#Cannot update {0} because it is assignment to group with read only memberships.|UNSAccountBInUNSGroupB|',41        18,42        2)43          WITH nowait44      END45      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw46      INSERT INTO @DBQueueElements_01(object,47      subobject,48      genprocid)49      SELECT50        x.uid,51        NULL,52        @GenProcID53      FROM(54      SELECT55        DISTINCT d.UID_UNSAccountB AS uid56      FROM deleted d57      JOIN UNSAccountBInUNSGroupB dd58        ON d.XObjectKey = dd.XObjectKey59      WHERE60        dbo.QBM_FGIXOriginChanged_Except2(d.XOrigin, dd.XOrigin) = 1 OR(d.XIsInEffect <> dd.XIsInEffect AND dbo.QBM_FGISessionContext('Fullsync'61      ) > ' ')) AS x62      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB',63        @DBQueueElements_0164    END65    IF66    UPDATE(XIsInEffect) OR67    UPDATE(XOrigin)68    BEGIN69      DECLARE @DBQueueElements_02 QBM_YDBQueueRaw70      INSERT INTO @DBQueueElements_02(object,71      subobject,72      genprocid)73      SELECT74        x.uid,75        NULL,76        @GenProcID77      FROM(78      SELECT79        DISTINCT x.UID_Person AS uid80      FROM UNSAccountBInUNSGroupB a81      JOIN deleted d82        ON a.XObjectKey = d.XObjectKey83      JOIN UNSAccountB x84        ON a.UID_UNSAccountB = x.UID_UNSAccountB85      WHERE86        x.UID_Person > ' ' AND(dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 OR dbo.QER_FCVXOriginToInheritInfo87      (d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(a.XOrigin))) AS x88      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject',89        @DBQueueElements_0290      IF '1' = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\IncludeTSBPersonUsesAccount')91      BEGIN92        DECLARE @DBQueueElements_PersonUsesAccount QBM_YDBQueueRaw93        INSERT INTO @DBQueueElements_PersonUsesAccount(object,94        subobject,95        genprocid)96        SELECT97          x.uid,98          NULL,99          @GenProcID100        FROM(101        SELECT102          DISTINCT t.uid_person AS uid103        FROM UNSAccountBInUNSGroupB aig104        JOIN deleted d105          ON aig.XObjectKey = d.XObjectKey106        JOIN UNSAccountB a107          ON aig.UID_UNSAccountB = a.UID_UNSAccountB108        JOIN TSBPersonUsesAccount t109          ON a.XObjectKey = t.ObjectKeyAccount110        WHERE111          (dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, aig.XOrigin, d.XIsInEffect, aig.XIsInEffect) = 1 OR dbo.QER_FCVXOriginToInheritInfo(d.XOrigin112        ) <> dbo.QER_FCVXOriginToInheritInfo(aig.XOrigin))) AS x113        EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject',114          @DBQueueElements_PersonUsesAccount115      END116      IF 'UNSGroupB' = 'UNSGroupB'117      BEGIN118        IF EXISTS(119          SELECT TOP 1 1120          FROM UNSItemB)121        BEGIN122          DECLARE @DBQueueElements_03 QBM_YDBQueueRaw123          INSERT INTO @DBQueueElements_03(object,124          subobject,125          genprocid)126          SELECT127            x.uid,128            NULL,129            @GenProcID130          FROM(131          SELECT132            DISTINCT d.UID_UNSAccountB AS uid133          FROM UNSAccountBInUNSGroupB a134          JOIN deleted d135            ON a.XObjectKey = d.XObjectKey AND dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect,136          a.XIsInEffect) = 1137          WHERE138            EXISTS(139          SELECT TOP 1 1140          FROM UNSAccountB acc141          JOIN UNSItemB b142            ON acc.UID_UNSRootB = b.UID_UNSRootB AND acc.UID_UNSAccountB = a.UID_UNSAccountB)) AS x143          EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBHasUNSItemB',144            @DBQueueElements_03145        END146      END147    END148  END TRY149  BEGIN CATCH150    EXEC QBM_PSessionErrorAdd DEFAULT151    RAISERROR('',152    18,153    1)154      WITH NOWAIT155  END CATCH156  ende:157  RETURN158END
Open raw exported source
SQL ยท Raw26 lines
1create   trigger TSB_TUUNSAccountBInUNSGroupB on UNSAccountBInUNSGroupB  for Update not for Replication as begin  declare @GenProcID varchar2(38) declare @XUser nvarchar(64) declare @QBM_BitPatternXMarkedForDel_OutStanding int = dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|', 0)  BEGIN TRY3 if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start: select @GenProcID = dbo.QBM_FGISessionContext4('') select @XUser = dbo.QBM_FGISessionContext('XUser') if update(XOrigin) or update(XIsInEffect) begin  if exists (select top 1 1 from deleted d join 5UNSAccountBInUNSGroupB dd on d.XObjectKey = dd.XObjectKey join UNSGroupB g on d.UID_UNSGroupB = g.UID_UNSGroupB where g.HasReadOnlyMemberships6 = 1 and d.XOrigin <> dd.XOrigin and dbo.QBM_FGISessionContext ('Fullsync') = '' and exists (select top 1 1 from UNSAccountB a where a.UID_UNSAccountB 7= d.UID_UNSAccountB and a.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_OutStanding = 0 ) ) begin raiserror( '#LDS#Cannot update {0} because it is assignment to group with read only memberships.|UNSAccountBInUNSGroupB|'8, 18, 2) with nowait end  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null9, @GenProcID from ( select distinct d.UID_UNSAccountB as uid from deleted d join UNSAccountBInUNSGroupB dd on d.XObjectKey = dd.XObjectKey where dbo.QBM_FGIXOriginChanged_Except210(d.XOrigin, dd.XOrigin) = 1  or (d.XIsInEffect <> dd.XIsInEffect and dbo.QBM_FGISessionContext ('Fullsync') > ' ' ) ) as x exec QBM_PDBQueueInsert_Bulk11 'TSB-K-UNSAccountBInUNSGroupB', @DBQueueElements_01 end  if update(XIsInEffect) or update(XOrigin) begin declare @DBQueueElements_02 QBM_YDBQueueRaw12 insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct x.UID_Person as uid from UNSAccountBInUNSGroupB13 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_Effect14(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 or dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(a.XOrigin) ) 15) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject', @DBQueueElements_02  if '1' = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\IncludeTSBPersonUsesAccount'16) begin declare @DBQueueElements_PersonUsesAccount QBM_YDBQueueRaw insert into @DBQueueElements_PersonUsesAccount (object, subobject, genprocid) select17 x.uid, null, @GenProcID from ( select distinct t.uid_person as uid from UNSAccountBInUNSGroupB aig join deleted d on aig.XObjectKey = d.XObjectKey 18join UNSAccountB a on aig.UID_UNSAccountB = a.UID_UNSAccountB join TSBPersonUsesAccount t on a.XObjectKey = t.ObjectKeyAccount where ( dbo.QBM_FGIXOriginChanged_Effect19(d.XOrigin, aig.XOrigin, d.XIsInEffect, aig.XIsInEffect) = 1 or dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(aig.XOrigin20) ) ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject', @DBQueueElements_PersonUsesAccount end  if 'UNSGroupB' = 'UNSGroupB'  begin if exists21 (select top 1 1 from UNSItemB ) begin declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select22 x.uid, null, @GenProcID from ( select distinct d.UID_UNSAccountB as uid from UNSAccountBInUNSGroupB a join deleted d on a.XObjectKey = d.XObjectKey23 and dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 where exists (select top 1 1 from UNSAccountB acc join UNSItemB24 b on acc.UID_UNSRootB = b.UID_UNSRootB and acc.UID_UNSAccountB = a.UID_UNSAccountB) ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBHasUNSItemB'25, @DBQueueElements_03 end end end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 26