Back to OIM Explorer

dbo.QER_TUQERReuseUS

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on QERReuseUS. Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 13; Bulk DBQueue insert -> QER-K-OrgHasQERReuseUS / QER_ZOrgHasQERReuseUS at line 13; Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 13; Bulk DBQueue insert -> QER-K-OrgHasQERReuseUS / QER_ZOrgHasQERReuseUS at line 16

Source: sandbox-db sys.sql_modules

Source size: 5.548 characters

Interpretation

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

Relations

  • Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 13
  • Bulk DBQueue insert -> QER-K-OrgHasQERReuseUS / QER_ZOrgHasQERReuseUS at line 13
  • Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 13
  • Bulk DBQueue insert -> QER-K-OrgHasQERReuseUS / QER_ZOrgHasQERReuseUS at line 16
  • Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 16
  • Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 23
  • References QBM_PJobCreate*
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: QERReuseUS

Typed Edges

  • queues DBQueue task QER_ZPersonHasQERReuseUS at line 13 Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 13
  • queues DBQueue task QER_ZOrgHasQERReuseUS at line 13 Bulk DBQueue insert -> QER-K-OrgHasQERReuseUS / QER_ZOrgHasQERReuseUS at line 13
  • queues DBQueue task QER_ZOrgHasQERReuseUS at line 16 Bulk DBQueue insert -> QER-K-OrgHasQERReuseUS / QER_ZOrgHasQERReuseUS at line 16
  • queues DBQueue task QER_ZPersonHasQERReuseUS at line 16 Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 16
  • queues DBQueue task QER_ZPersonHasQERReuseUS at line 23 Bulk DBQueue insert -> QER-K-PersonHasQERReuseUS / QER_ZPersonHasQERReuseUS at line 23
  • trigger on table QERReuseUS Trigger parent table: QERReuseUS
  • references source dbo.QBM_FCVBigIntToString source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PJobCreate source text reference
  • references source dbo.QBM_PJobCreate_HOUpdate source text reference
  • references source dbo.QBM_PJobCreate_HOUpdate_B source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PIsForITShopFlagCheck source text reference
  • references source dbo.QER_PITShopHelperFill source text reference
  • references source dbo.QER_PITShopHelperFill_Recalc source text reference
  • references source dbo.QER_TUQERReuse source text reference

Complete Source

SQL231 lines
1CREATE trigger QER_TUQERReuseUS2  ON QERReuseUS FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @ObjectkeyOrdered varchar(138)7  DECLARE @UID_AccProduct varchar(38)8  DECLARE @whereclauseOrg nvarchar(max)9  DECLARE @whereclauseMuster nvarchar(max) = ' UID_ITShopOrg in ( select UID_OrgPR 10							from QER_VPWOProductNodesSlim11							where ObjectkeyOrdered = ''@ObjectkeyOrdered'' 12								and isnull(UID_AccProduct, '''') <> ''@UID_AccProduct''13					)14'15  DECLARE @ElementBuffer QBM_YCursorBuffer16  DECLARE @ElementCount int17  DECLARE @ElementIndex int18  BEGIN TRY19    IF EXISTS(20      SELECT TOP 1 121      FROM inserted)22    GOTO start23    IF EXISTS(24      SELECT TOP 1 125      FROM deleted)26    GOTO start27    RETURN start:28    DECLARE @GenProcID varchar(38)29    SELECT @GenProcID = dbo.QBM_FGISessionContext('')30    IF31    UPDATE(UID_QERReuseUSPredecessor)32    BEGIN33      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw34      INSERT INTO @DBQueueElements_01(object,35      subobject,36      genprocid)37      SELECT38        x.uid,39        NULL,40        @GenProcID41      FROM(42      SELECT43        DISTINCT phr.UID_Person AS uid44      FROM QERReuseUS v45      JOIN deleted d46        ON d.uid_QERReuseUS = v.UID_QERReuseUS AND isnull(v.UID_QERReuseUSPredecessor, '') <> ISNULL(d.UID_QERReuseUSPredecessor,47      '')48      JOIN PersonHasQERReuseUS phr49        ON phr.UID_QERReuseUS = v.UID_QERReuseUS AND phr.XOrigin > 0) AS x50      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-PersonHasQERReuseUS',51        @DBQueueElements_0152      DECLARE @DBQueueElements_02 QBM_YDBQueueRaw53      INSERT INTO @DBQueueElements_02(object,54      subobject,55      genprocid)56      SELECT57        x.uid,58        NULL,59        @GenProcID60      FROM(61      SELECT62        DISTINCT phr.UID_org AS uid63      FROM QERReuseUS v64      JOIN deleted d65        ON d.uid_QERReuseUS = v.UID_QERReuseUS AND isnull(v.UID_QERReuseUSPredecessor, '') <> ISNULL(d.UID_QERReuseUSPredecessor,66      '')67      JOIN BaseTreeHasQERReuseUS phr68        ON phr.UID_QERReuseUS = v.UID_QERReuseUS AND phr.XOrigin > 0) AS x69      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgHasQERReuseUS',70        @DBQueueElements_0271    END72    IF73    UPDATE(isForITShop) OR74    UPDATE(isITShopOnly)75    BEGIN76      DECLARE @FlagTest QBM_YParameterlist77      INSERT INTO @FlagTest(Parameter1,78      Parameter2,79      HasContentFull,80      e.Parameter3)81      SELECT82        i.UID_QERReuseUS,83        i.XObjectKey,84        i.IsForITShop,85        dbo.QBM_FCVBigIntToString(i.IsITShopOnly)86      FROM inserted i87      EXEC QER_PIsForITShopFlagCheck 'QERReuseUS',88        @FlagTest89    END90    IF91    UPDATE(IsNoInheriteToSecurityIncident)92    BEGIN93      DECLARE @DBQueueElements_03 QBM_YDBQueueRaw94      INSERT INTO @DBQueueElements_03(object,95      subobject,96      genprocid)97      SELECT98        x.uid,99        NULL,100        @GenProcID101      FROM(102      SELECT103        DISTINCT phr.UID_Person AS uid104      FROM QERReuseUS v105      JOIN deleted d106        ON d.uid_QERReuseUS = v.UID_QERReuseUS107      JOIN PersonHasQERReuseUS phr108        ON phr.UID_QERReuseUS = v.UID_QERReuseUS AND phr.XOrigin > 0109      WHERE110        (d.IsNoInheriteToSecurityIncident = 1 AND v.IsNoInheriteToSecurityIncident = 0 AND phr.XIsInEffect = 0) OR(d.IsNoInheriteToSecurityIncident111      = 0 AND v.IsNoInheriteToSecurityIncident = 1 AND phr.XIsInEffect = 1)) AS x112      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-PersonHasQERReuseUS',113        @DBQueueElements_03114    END115    IF116    UPDATE(uid_accproduct)117    BEGIN118      INSERT INTO @ElementBuffer(ObjectKey1,119      UID1)120      SELECT121        x.XObjectKey,122        isnull(x.uid_accproduct,123        '')124      FROM QERReuseUS x125      JOIN deleted d126        ON x.uid_QERReuseUS = d.uid_QERReuseUS AND isnull(x.uid_accproduct,127      '') <> isnull(d.uid_accproduct,128      '') AND d.uid_accproduct > ' '129      JOIN dialogColumn c130        ON c.UID_DialogTable = 'QER-T-ITShopOrg' AND c.columnname = 'uid_ACCProduct' AND c.IsDeactivatedByPreProcessor = 0131      SELECT @ElementCount = @@ROWCOUNT132      SELECT @ElementIndex = 1133      WHILE @ElementIndex <= @ElementCount134      BEGIN135        SELECT136          TOP 1 @ObjectkeyOrdered = bu.ObjectKey1,137          @UID_AccProduct = bu.UID1138        FROM @ElementBuffer bu139        WHERE140          bu.ElementIndex = @ElementIndex141        SELECT @whereclauseOrg = @whereclauseMuster142        SELECT143          @whereclauseOrg = replace(@whereclauseOrg,144          N '@ObjectkeyOrdered',145          @ObjectkeyOrdered)146        SELECT147          @whereclauseOrg = replace(@whereclauseOrg,148          N '@uid_accproduct',149          rtrim(@uid_accproduct))150        EXEC QBM_PJobCreate_HOUpdate_B N 'ITShopOrg',151          @whereclauseOrg,152          @GenProcID,153          @p1 = 'uid_ACCProduct',154          @v1 = @uid_accproduct,155          @AdditionalObjectKeysAffected = DEFAULT156        SELECT @ElementIndex += 1157      END158    END159    IF160    UPDATE(UID_AccProduct)161    BEGIN162      DECLARE @RecalcParameter_OA QBM_YCursorBuffer163      INSERT INTO @RecalcParameter_OA(UID1,164      ObjectKey1,165      Ident1)166      SELECT167        'QER-PWODecisionRule-OA',168        a.XObjectKey,169        'I'170      FROM inserted i171      JOIN QERReuseUS g172        ON i.UID_QERReuseUS = g.UID_QERReuseUS173      JOIN QERAccProductUsage u174        ON g.XObjectKey = u.XObjectKey175      JOIN AccProduct a176        ON u.UID_AccProduct = a.UID_AccProduct177      UNION178      SELECT179        'QER-PWODecisionRule-OA',180        a.XObjectKey,181        'I'182      FROM deleted d183      JOIN QERReuseUS g184        ON d.UID_QERReuseUS = g.UID_QERReuseUS185      JOIN QERAccProductUsage u186        ON g.XObjectKey = u.XObjectKey187      JOIN AccProduct a188        ON u.UID_AccProduct = a.UID_AccProduct189      EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_OA,190        @GenprocID191      DECLARE @RecalcParameter_OA2 QBM_YCursorBuffer192      INSERT INTO @RecalcParameter_OA2(UID1,193      ObjectKey1,194      Ident1)195      SELECT196        'QER-PWODecisionRule-OA',197        pwo.XObjectKey,198        'I'199      FROM inserted i200      JOIN QERReuseUS g201        ON i.UID_QERReuseUS = g.UID_QERReuseUS202      JOIN AccProduct a203        ON i.UID_AccProduct = a.UID_AccProduct204      JOIN PersonWantsOrg pwo205        ON g.XObjectKey = pwo.ObjectKeyElementUsedInAssign206      UNION207      SELECT208        'QER-PWODecisionRule-OA',209        pwo.XObjectKey,210        'I'211      FROM deleted d212      JOIN QERReuseUS g213        ON d.UID_QERReuseUS = g.UID_QERReuseUS214      JOIN AccProduct a215        ON d.UID_AccProduct = a.UID_AccProduct216      JOIN PersonWantsOrg pwo217        ON g.XObjectKey = pwo.ObjectKeyElementUsedInAssign218      EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_OA2,219        @GenprocID220    END221  END TRY222  BEGIN CATCH223    EXEC QBM_PSessionErrorAdd DEFAULT224    RAISERROR('',225    18,226    1)227      WITH NOWAIT228  END CATCH229  ende:230  RETURN231END
Open raw exported source
SQL ยท Raw41 lines
1 create   trigger QER_TUQERReuseUS on QERReuseUS  for Update not for Replication as begin  declare @ObjectkeyOrdered varchar(138) declare @UID_AccProduct2 varchar(38) declare @whereclauseOrg nvarchar(max) declare @whereclauseMuster nvarchar(max) = ' UID_ITShopOrg in ( select UID_OrgPR 3							from QER_VPWOProductNodesSlim4							where ObjectkeyOrdered = ''@ObjectkeyOrdered'' 5								and isnull(UID_AccProduct, '''') <> ''@UID_AccProduct''6					)7'8 declare @ElementBuffer QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int BEGIN TRY if exists (select top 1 1 from inserted) goto start9 if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if update10(UID_QERReuseUSPredecessor) begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid11, null, @GenProcID from ( select distinct phr.UID_Person as uid from QERReuseUS v join deleted d on d.uid_QERReuseUS = v.UID_QERReuseUS and isnull(v.UID_QERReuseUSPredecessor12, '') <> ISNULL(d.UID_QERReuseUSPredecessor, '') join PersonHasQERReuseUS phr on phr.UID_QERReuseUS = v.UID_QERReuseUS and phr.XOrigin > 0  ) as x exec13 QBM_PDBQueueInsert_Bulk 'QER-K-PersonHasQERReuseUS', @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object14, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct phr.UID_org as uid from QERReuseUS v join deleted d on d.uid_QERReuseUS =15 v.UID_QERReuseUS and isnull(v.UID_QERReuseUSPredecessor, '') <> ISNULL(d.UID_QERReuseUSPredecessor, '') join BaseTreeHasQERReuseUS phr on phr.UID_QERReuseUS16 = v.UID_QERReuseUS and phr.XOrigin > 0  ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgHasQERReuseUS', @DBQueueElements_02 end if update(isForITShop) or17 update(isITShopOnly) begin declare @FlagTest QBM_YParameterlist insert into @FlagTest(Parameter1, Parameter2, HasContentFull, e.Parameter3) select i.UID_QERReuseUS18, i.XObjectKey, i.IsForITShop, dbo.QBM_FCVBigIntToString(i.IsITShopOnly) from inserted i exec QER_PIsForITShopFlagCheck 'QERReuseUS', @FlagTest end    19 if update(IsNoInheriteToSecurityIncident) begin declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid20) select x.uid, null, @GenProcID from ( select distinct phr.UID_Person as uid from QERReuseUS v join deleted d on d.uid_QERReuseUS = v.UID_QERReuseUS join21 PersonHasQERReuseUS phr on phr.UID_QERReuseUS = v.UID_QERReuseUS and phr.XOrigin > 0  where (d.IsNoInheriteToSecurityIncident = 1 and v.IsNoInheriteToSecurityIncident22 = 0 and phr.XIsInEffect = 0 ) or (d.IsNoInheriteToSecurityIncident = 0 and v.IsNoInheriteToSecurityIncident = 1 and phr.XIsInEffect = 1 ) ) as x exec 23QBM_PDBQueueInsert_Bulk 'QER-K-PersonHasQERReuseUS', @DBQueueElements_03 end if update(uid_accproduct) begin insert into @ElementBuffer(ObjectKey1, UID124) select x.XObjectKey, isnull(x.uid_accproduct,'') from QERReuseUS x join deleted d on x.uid_QERReuseUS = d.uid_QERReuseUS and isnull(x.uid_accproduct,25'') <> isnull(d.uid_accproduct,'')  and d.uid_accproduct > ' '  join dialogColumn c on c.UID_DialogTable = 'QER-T-ITShopOrg' and c.columnname = 'uid_ACCProduct'26 and c.IsDeactivatedByPreProcessor = 0  select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top27 1 @ObjectkeyOrdered = bu.ObjectKey1 , @UID_AccProduct = bu.UID1 from @ElementBuffer bu where bu.ElementIndex = @ElementIndex select @whereclauseOrg = 28@whereclauseMuster select @whereclauseOrg = replace(@whereclauseOrg, N'@ObjectkeyOrdered' , @ObjectkeyOrdered) select @whereclauseOrg = replace(@whereclauseOrg29, N'@uid_accproduct' , rtrim(@uid_accproduct))    exec QBM_PJobCreate_HOUpdate_B N'ITShopOrg', @whereclauseOrg, @GenProcID , @p1 = 'uid_ACCProduct', @v130 = @uid_accproduct , @AdditionalObjectKeysAffected = DEFAULT select @ElementIndex += 1 end  end    if update (UID_AccProduct) begin declare @RecalcParameter_OA31 QBM_YCursorBuffer insert into @RecalcParameter_OA (UID1, ObjectKey1, Ident1) select 'QER-PWODecisionRule-OA', a.XObjectKey, 'I' from inserted i join QERReuseUS32 g on i.UID_QERReuseUS = g.UID_QERReuseUS join QERAccProductUsage u on g.XObjectKey = u.XObjectKey join AccProduct a on u.UID_AccProduct = a.UID_AccProduct33 union select 'QER-PWODecisionRule-OA', a.XObjectKey, 'I' from deleted d join QERReuseUS g on d.UID_QERReuseUS = g.UID_QERReuseUS join QERAccProductUsage34 u on g.XObjectKey = u.XObjectKey join AccProduct a on u.UID_AccProduct = a.UID_AccProduct exec QER_PITShopHelperFill_Recalc @RecalcParameter_OA, @GenprocID35 declare @RecalcParameter_OA2 QBM_YCursorBuffer insert into @RecalcParameter_OA2 (UID1, ObjectKey1, Ident1) select 'QER-PWODecisionRule-OA', pwo.XObjectKey36, 'I' from inserted i join QERReuseUS g on i.UID_QERReuseUS = g.UID_QERReuseUS join AccProduct a on i.UID_AccProduct = a.UID_AccProduct join PersonWantsOrg37 pwo on g.XObjectKey = pwo.ObjectKeyElementUsedInAssign union select 'QER-PWODecisionRule-OA', pwo.XObjectKey, 'I' from deleted d join QERReuseUS g on 38d.UID_QERReuseUS = g.UID_QERReuseUS join AccProduct a on d.UID_AccProduct = a.UID_AccProduct join PersonWantsOrg pwo on g.XObjectKey = pwo.ObjectKeyElementUsedInAssign39 exec QER_PITShopHelperFill_Recalc @RecalcParameter_OA2, @GenprocID end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH40 NOWAIT END CATCH ende: return end 41