Back to OIM Explorer

dbo.TSB_TUUNSAccountB

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on UNSAccountB. Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 5; Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 5; Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 5; Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 5

Source: sandbox-db sys.sql_modules

Source size: 6.865 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-PersonHasObject / TSB_ZPersonHasObject at line 5
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 5
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 5
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 5
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 5
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 5
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 12
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 17
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 22
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 22
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 22
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 22
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 22
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 22
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 28
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 28
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 28
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 28
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 28
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 31
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 31
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 31
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 31
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 35
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 35
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 35
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 39
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 39
  • Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 42
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: UNSAccountB

Typed Edges

  • queues DBQueue task TSB_ZPersonHasObject at line 5 Bulk DBQueue insert -> TSB-K-PersonHasObject / TSB_ZPersonHasObject at line 5
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 5 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 5
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 5 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 5
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 5 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 5
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 5 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 5
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 12 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 12
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 12 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 12
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 12 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 12
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 12 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 12
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 17 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 17
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 17 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 17
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 17 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 17
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 17 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 17
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 22 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 22
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 22 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 22
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 22 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 22
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 22 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 22
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 28 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 28
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 28 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 28
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 28 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 28
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 28 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 28
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB at line 31 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB / TSB_ZUNSAccountBInUNSGroupB at line 31
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 31 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 31
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 31 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 31
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 31 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 31
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB1 at line 35 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB1 / TSB_ZUNSAccountBInUNSGroupB1 at line 35
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 35 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 35
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 35 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 35
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB2 at line 39 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB2 / TSB_ZUNSAccountBInUNSGroupB2 at line 39
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 39 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 39
  • queues DBQueue task TSB_ZUNSAccountBInUNSGroupB3 at line 42 Bulk DBQueue insert -> TSB-K-UNSAccountBInUNSGroupB3 / TSB_ZUNSAccountBInUNSGroupB3 at line 42
  • trigger on table UNSAccountB Trigger parent table: UNSAccountB
  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL241 lines
1CREATE trigger TSB_TUUNSAccountB2  ON UNSAccountB FOR3UPDATE NOT FOR Replication4AS5BEGIN6  IF EXISTS(7    SELECT TOP 1 18    FROM inserted)9  GOTO start10  IF EXISTS(11    SELECT TOP 1 112    FROM deleted)13  GOTO start14  RETURN start:15  DECLARE @GenProcID varchar(38)16  DECLARE @QBM_BitPatternXMarkedForDel_OutStanding int = dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|',17  0)18  BEGIN TRY19    SELECT @GenProcID = dbo.QBM_FGISessionContext('')20    IF21    UPDATE(UID_Person)22    BEGIN23      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw24      INSERT INTO @DBQueueElements_01(object,25      subobject,26      genprocid)27      SELECT28        x.uid,29        NULL,30        @GenProcID31      FROM(32      SELECT uid_person AS uid33      FROM inserted34      WHERE35        uid_person > ' '36      UNION37      SELECT uid_person38      FROM deleted39      WHERE40        uid_person > ' ') AS x41      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject',42        @DBQueueElements_0143    END44    IF45    UPDATE(UID_Person) OR46    UPDATE(UID_TSBBehavior) OR47    UPDATE(MatchPatternForMembership) OR48    UPDATE(AccountDisabled) OR49    UPDATE(XMarkedForDeletion)50    BEGIN51      DECLARE @DBQueueElements_03 QBM_YDBQueueRaw52      INSERT INTO @DBQueueElements_03(object,53      subobject,54      genprocid)55      SELECT56        x.uid,57        NULL,58        @GenProcID59      FROM(60      SELECT a.UID_UNSAccountB AS uid61      FROM UNSAccountB a62      JOIN deleted d63        ON a.UID_UNSAccountB = d.UID_UNSAccountB64      JOIN UNSRootB r65        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x01 > 066      WHERE67        isnull(d.UID_Person, '') <> isnull(a.UID_Person, '') OR isnull(d.UID_UNSContainerB, '') <> isnull(a.UID_UNSContainerB,68      '') OR isnull(d.UID_TSBBehavior, '') <> isnull(a.UID_TSBBehavior, '') OR isnull(d.MatchPatternForMembership,69      0) <> isnull(a.MatchPatternForMembership, 0) OR isnull(d.AccountDisabled, 0) <> isnull(a.AccountDisabled,70      0) OR(d.XMarkedForDeletion ^ a.XMarkedForDeletion) & @QBM_BitPatternXMarkedForDel_OutStanding > 0) AS x71      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB',72        @DBQueueElements_0373      DECLARE @DBQueueElements_04 QBM_YDBQueueRaw74      INSERT INTO @DBQueueElements_04(object,75      subobject,76      genprocid)77      SELECT78        x.uid,79        NULL,80        @GenProcID81      FROM(82      SELECT a.UID_UNSAccountB AS uid83      FROM UNSAccountB a84      JOIN deleted d85        ON a.UID_UNSAccountB = d.UID_UNSAccountB86      JOIN UNSRootB r87        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x02 > 088      WHERE89        isnull(d.UID_Person, '') <> isnull(a.UID_Person, '') OR isnull(d.UID_UNSContainerB, '') <> isnull(a.UID_UNSContainerB,90      '') OR isnull(d.UID_TSBBehavior, '') <> isnull(a.UID_TSBBehavior, '') OR isnull(d.MatchPatternForMembership,91      0) <> isnull(a.MatchPatternForMembership, 0) OR isnull(d.AccountDisabled, 0) <> isnull(a.AccountDisabled,92      0) OR(d.XMarkedForDeletion ^ a.XMarkedForDeletion) & @QBM_BitPatternXMarkedForDel_OutStanding > 0) AS x93      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB1',94        @DBQueueElements_0495      DECLARE @DBQueueElements_05 QBM_YDBQueueRaw96      INSERT INTO @DBQueueElements_05(object,97      subobject,98      genprocid)99      SELECT100        x.uid,101        NULL,102        @GenProcID103      FROM(104      SELECT a.UID_UNSAccountB AS uid105      FROM UNSAccountB a106      JOIN deleted d107        ON a.UID_UNSAccountB = d.UID_UNSAccountB108      JOIN UNSRootB r109        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x04 > 0110      WHERE111        isnull(d.UID_Person, '') <> isnull(a.UID_Person, '') OR isnull(d.UID_UNSContainerB, '') <> isnull(a.UID_UNSContainerB,112      '') OR isnull(d.UID_TSBBehavior, '') <> isnull(a.UID_TSBBehavior, '') OR isnull(d.MatchPatternForMembership,113      0) <> isnull(a.MatchPatternForMembership, 0) OR isnull(d.AccountDisabled, 0) <> isnull(a.AccountDisabled,114      0) OR(d.XMarkedForDeletion ^ a.XMarkedForDeletion) & @QBM_BitPatternXMarkedForDel_OutStanding > 0) AS x115      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB2',116        @DBQueueElements_05117      DECLARE @DBQueueElements_06 QBM_YDBQueueRaw118      INSERT INTO @DBQueueElements_06(object,119      subobject,120      genprocid)121      SELECT122        x.uid,123        NULL,124        @GenProcID125      FROM(126      SELECT a.UID_UNSAccountB AS uid127      FROM UNSAccountB a128      JOIN deleted d129        ON a.UID_UNSAccountB = d.UID_UNSAccountB130      JOIN UNSRootB r131        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x08 > 0132      WHERE133        isnull(d.UID_Person, '') <> isnull(a.UID_Person, '') OR isnull(d.UID_UNSContainerB, '') <> isnull(a.UID_UNSContainerB,134      '') OR isnull(d.UID_TSBBehavior, '') <> isnull(a.UID_TSBBehavior, '') OR isnull(d.MatchPatternForMembership,135      0) <> isnull(a.MatchPatternForMembership, 0) OR isnull(d.AccountDisabled, 0) <> isnull(a.AccountDisabled,136      0) OR(d.XMarkedForDeletion ^ a.XMarkedForDeletion) & @QBM_BitPatternXMarkedForDel_OutStanding > 0) AS x137      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB3',138        @DBQueueElements_06139    END140    IF141    UPDATE(IsGroupAccount_UNSGroupB)142    BEGIN143      DECLARE @DBQueueElements_07 QBM_YDBQueueRaw144      INSERT INTO @DBQueueElements_07(object,145      subobject,146      genprocid)147      SELECT148        x.uid,149        NULL,150        @GenProcID151      FROM(152      SELECT a.UID_UNSAccountB AS uid153      FROM UNSAccountB a154      JOIN deleted d155        ON a.UID_UNSAccountB = d.UID_UNSAccountB156      JOIN UNSRootB r157        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x01 > 0158      WHERE159        isnull(d.IsGroupAccount_UNSGroupB, 0) <> isnull(a.IsGroupAccount_UNSGroupB, 0) AND a.UID_Person > ' ') AS x160      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB',161        @DBQueueElements_07162    END163    IF164    UPDATE(IsGroupAccount_UNSGroupB1)165    BEGIN166      DECLARE @DBQueueElements_08 QBM_YDBQueueRaw167      INSERT INTO @DBQueueElements_08(object,168      subobject,169      genprocid)170      SELECT171        x.uid,172        NULL,173        @GenProcID174      FROM(175      SELECT a.UID_UNSAccountB AS uid176      FROM UNSAccountB a177      JOIN deleted d178        ON a.UID_UNSAccountB = d.UID_UNSAccountB179      JOIN UNSRootB r180        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x02 > 0181      WHERE182        isnull(d.IsGroupAccount_UNSGroupB1, 0) <> isnull(a.IsGroupAccount_UNSGroupB1, 0) AND a.UID_Person > ' ') AS x183      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB1',184        @DBQueueElements_08185    END186    IF187    UPDATE(IsGroupAccount_UNSGroupB2)188    BEGIN189      DECLARE @DBQueueElements_09 QBM_YDBQueueRaw190      INSERT INTO @DBQueueElements_09(object,191      subobject,192      genprocid)193      SELECT194        x.uid,195        NULL,196        @GenProcID197      FROM(198      SELECT a.UID_UNSAccountB AS uid199      FROM UNSAccountB a200      JOIN deleted d201        ON a.UID_UNSAccountB = d.UID_UNSAccountB202      JOIN UNSRootB r203        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x04 > 0204      WHERE205        isnull(d.IsGroupAccount_UNSGroupB2, 0) <> isnull(a.IsGroupAccount_UNSGroupB2, 0) AND a.UID_Person > ' ') AS x206      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB2',207        @DBQueueElements_09208    END209    IF210    UPDATE(IsGroupAccount_UNSGroupB3)211    BEGIN212      DECLARE @DBQueueElements_10 QBM_YDBQueueRaw213      INSERT INTO @DBQueueElements_10(object,214      subobject,215      genprocid)216      SELECT217        x.uid,218        NULL,219        @GenProcID220      FROM(221      SELECT a.UID_UNSAccountB AS uid222      FROM UNSAccountB a223      JOIN deleted d224        ON a.UID_UNSAccountB = d.UID_UNSAccountB225      JOIN UNSRootB r226        ON a.UID_UNSRootB = r.UID_UNSRootB AND r.GroupUsageMask & 0x08 > 0227      WHERE228        isnull(d.IsGroupAccount_UNSGroupB3, 0) <> isnull(a.IsGroupAccount_UNSGroupB3, 0) AND a.UID_Person > ' ') AS x229      EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB3',230        @DBQueueElements_10231    END232  END TRY233  BEGIN CATCH234    EXEC QBM_PSessionErrorAdd DEFAULT235    RAISERROR('',236    18,237    1)238      WITH NOWAIT239  END CATCH240  RETURN241END
Open raw exported source
SQL ยท Raw44 lines
1create   trigger TSB_TUUNSAccountB on UNSAccountB  for Update not for Replication as begin  if exists (select top 1 1 from inserted) goto start 2if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) declare @QBM_BitPatternXMarkedForDel_OutStanding int = 3dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|', 0) BEGIN TRY select @GenProcID = dbo.QBM_FGISessionContext('') if update(UID_Person) begin declare 4@DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select uid_person5 as uid from inserted where uid_person > ' ' union select uid_person from deleted where uid_person > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-PersonHasObject'6, @DBQueueElements_01 end if update(UID_Person)   or update(UID_TSBBehavior) or update(MatchPatternForMembership) or update(AccountDisabled)  or update7(XMarkedForDeletion) begin declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select x.uid, null8, @GenProcID from (select a.UID_UNSAccountB as uid from UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB join UNSRootB r on a.UID_UNSRootB9 = r.UID_UNSRootB and r.GroupUsageMask & 0x01 > 0 where isnull(d.UID_Person,'') <> isnull(a.UID_Person,'') or isnull(d.UID_UNSContainerB,'') <> isnull(a.UID_UNSContainerB10,'') or isnull(d.UID_TSBBehavior,'') <> isnull(a.UID_TSBBehavior,'') or isnull(d.MatchPatternForMembership,0) <> isnull(a.MatchPatternForMembership,0) 11or isnull(d.AccountDisabled,0) <> isnull(a.AccountDisabled,0)  or (d.XMarkedForDeletion ^ a.XMarkedForDeletion ) & @QBM_BitPatternXMarkedForDel_OutStanding12 > 0 ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB', @DBQueueElements_03 declare @DBQueueElements_04 QBM_YDBQueueRaw insert into @DBQueueElements_0413 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select a.UID_UNSAccountB as uid from UNSAccountB a join deleted d on a.UID_UNSAccountB14 = d.UID_UNSAccountB join UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB and r.GroupUsageMask & 0x02 > 0 where isnull(d.UID_Person,'') <> isnull(a.UID_Person15,'') or isnull(d.UID_UNSContainerB,'') <> isnull(a.UID_UNSContainerB,'') or isnull(d.UID_TSBBehavior,'') <> isnull(a.UID_TSBBehavior,'') or isnull(d.MatchPatternForMembership16,0) <> isnull(a.MatchPatternForMembership,0) or isnull(d.AccountDisabled,0) <> isnull(a.AccountDisabled,0)  or (d.XMarkedForDeletion ^ a.XMarkedForDeletion17 ) & @QBM_BitPatternXMarkedForDel_OutStanding > 0 ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB1', @DBQueueElements_04 declare @DBQueueElements_0518 QBM_YDBQueueRaw insert into @DBQueueElements_05 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select a.UID_UNSAccountB as uid from19 UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB join UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB and r.GroupUsageMask & 0x04 >20 0 where isnull(d.UID_Person,'') <> isnull(a.UID_Person,'') or isnull(d.UID_UNSContainerB,'') <> isnull(a.UID_UNSContainerB,'') or isnull(d.UID_TSBBehavior21,'') <> isnull(a.UID_TSBBehavior,'') or isnull(d.MatchPatternForMembership,0) <> isnull(a.MatchPatternForMembership,0) or isnull(d.AccountDisabled,0) <>22 isnull(a.AccountDisabled,0)  or (d.XMarkedForDeletion ^ a.XMarkedForDeletion ) & @QBM_BitPatternXMarkedForDel_OutStanding > 0 ) as x exec QBM_PDBQueueInsert_Bulk23 'TSB-K-UNSAccountBInUNSGroupB2', @DBQueueElements_05 declare @DBQueueElements_06 QBM_YDBQueueRaw insert into @DBQueueElements_06 (object, subobject, genprocid24) select x.uid, null, @GenProcID from (select a.UID_UNSAccountB as uid from UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB join 25UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB and r.GroupUsageMask & 0x08 > 0 where isnull(d.UID_Person,'') <> isnull(a.UID_Person,'') or isnull(d.UID_UNSContainerB26,'') <> isnull(a.UID_UNSContainerB,'') or isnull(d.UID_TSBBehavior,'') <> isnull(a.UID_TSBBehavior,'') or isnull(d.MatchPatternForMembership,0) <> isnull27(a.MatchPatternForMembership,0) or isnull(d.AccountDisabled,0) <> isnull(a.AccountDisabled,0)  or (d.XMarkedForDeletion ^ a.XMarkedForDeletion ) & @QBM_BitPatternXMarkedForDel_OutStanding28 > 0 ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB3', @DBQueueElements_06 end if update(IsGroupAccount_UNSGroupB) begin declare @DBQueueElements_0729 QBM_YDBQueueRaw insert into @DBQueueElements_07 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select a.UID_UNSAccountB as uid from30 UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB join UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB and r.GroupUsageMask & 0x01 >31 0 where isnull(d.IsGroupAccount_UNSGroupB,0) <> isnull(a.IsGroupAccount_UNSGroupB,0) and a.UID_Person > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB'32, @DBQueueElements_07 end if update(IsGroupAccount_UNSGroupB1) begin declare @DBQueueElements_08 QBM_YDBQueueRaw insert into @DBQueueElements_08 (object33, subobject, genprocid) select x.uid, null, @GenProcID from (select a.UID_UNSAccountB as uid from UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB34 join UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB and r.GroupUsageMask & 0x02 > 0 where isnull(d.IsGroupAccount_UNSGroupB1,0) <> isnull(a.IsGroupAccount_UNSGroupB135,0) and a.UID_Person > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB1', @DBQueueElements_08 end if update(IsGroupAccount_UNSGroupB236) begin declare @DBQueueElements_09 QBM_YDBQueueRaw insert into @DBQueueElements_09 (object, subobject, genprocid) select x.uid, null, @GenProcID from 37(select a.UID_UNSAccountB as uid from UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB join UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB38 and r.GroupUsageMask & 0x04 > 0 where isnull(d.IsGroupAccount_UNSGroupB2,0) <> isnull(a.IsGroupAccount_UNSGroupB2,0) and a.UID_Person > ' ' ) as x exec39 QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB2', @DBQueueElements_09 end if update(IsGroupAccount_UNSGroupB3) begin declare @DBQueueElements_1040 QBM_YDBQueueRaw insert into @DBQueueElements_10 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select a.UID_UNSAccountB as uid from41 UNSAccountB a join deleted d on a.UID_UNSAccountB = d.UID_UNSAccountB join UNSRootB r on a.UID_UNSRootB = r.UID_UNSRootB and r.GroupUsageMask & 0x08 >42 0 where isnull(d.IsGroupAccount_UNSGroupB3,0) <> isnull(a.IsGroupAccount_UNSGroupB3,0) and a.UID_Person > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-UNSAccountBInUNSGroupB3'43, @DBQueueElements_10 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH  return end 44