Back to OIM Explorer

dbo.QER_TUQERUniversalSubstitute

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on QERUniversalSubstitute. Bulk DBQueue insert -> QER-K-ShoppingRackPWOHelperPWO / QER_ZITShopHelperFill at line 12; Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 12; Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 12; Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 16

Source: sandbox-db sys.sql_modules

Source size: 3.259 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 -> QER-K-ShoppingRackPWOHelperPWO / QER_ZITShopHelperFill at line 12
  • Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 12
  • Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 12
  • Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 16
  • Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 16
  • Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 20
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: QERUniversalSubstitute

Typed Edges

  • queues DBQueue task QER_ZITShopHelperFill at line 12 Bulk DBQueue insert -> QER-K-ShoppingRackPWOHelperPWO / QER_ZITShopHelperFill at line 12
  • queues DBQueue task QER_ZHelperHeadOrg at line 12 Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 12
  • queues DBQueue task QER_ZHelperHeadPerson at line 12 Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 12
  • queues DBQueue task QER_ZHelperHeadOrg at line 16 Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 16
  • queues DBQueue task QER_ZHelperHeadPerson at line 16 Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 16
  • queues DBQueue task QER_ZHelperHeadPerson at line 20 Bulk DBQueue insert -> QER-K-HelperHeadPerson / QER_ZHelperHeadPerson at line 20
  • trigger on table QERUniversalSubstitute Trigger parent table: QERUniversalSubstitute
  • 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

References

Referenced By

  • No direct source references extracted.

Complete Source

SQL113 lines
1CREATE trigger QER_TUQERUniversalSubstitute2  ON QERUniversalSubstitute FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @GenProcID varchar(38) = dbo.QBM_FGISessionContext('')7  BEGIN TRY8    IF EXISTS(9      SELECT TOP 1 110      FROM inserted)11    GOTO start12    IF EXISTS(13      SELECT TOP 1 114      FROM deleted)15    GOTO start16    RETURN start:17    IF18    UPDATE(IsCurrentlyActive) OR19    UPDATE(UseForITShopCompliance) OR20    UPDATE(UseForITShop)21    BEGIN22      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw23      INSERT INTO @DBQueueElements_01(object,24      subobject,25      genprocid)26      SELECT27        x.uid,28        NULL,29        @GenProcID30      FROM(31      SELECT pwo.UID_PersonWantsOrg AS uid32      FROM deleted d33      JOIN QERUniversalSubstitute su34        ON d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute35      JOIN PWOHelperPWO h36        ON su.UID_PersonReceiver = h.UID_PersonHead37      JOIN PersonWantsOrg pwo38        ON h.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg AND h.LevelNumber = pwo.DecisionLevel39      WHERE40        ((d.IsCurrentlyActive = 1 AND su.IsCurrentlyActive = 0) OR(d.UseForITShop = 1 AND su.UseForITShop = 0) OR(d.UseForITShopCompliance = 1 AND41      su.UseForITShopCompliance = 0)) AND pwo.OrderState IN('OrderProduct', 'OrderProlongate', 'OrderUnsubscribe')42      UNION43      SELECT pwo.UID_PersonWantsOrg AS uid44      FROM deleted d45      JOIN QERUniversalSubstitute su46        ON d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute47      JOIN PWOHelperPWO h48        ON d.UID_PersonSender = h.UID_PersonHead49      JOIN PersonWantsOrg pwo50        ON h.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg AND h.LevelNumber = pwo.DecisionLevel51      WHERE52        ((d.IsCurrentlyActive = 0 AND su.IsCurrentlyActive = 1) OR(d.UseForITShop = 0 AND su.UseForITShop = 1) OR(d.UseForITShopCompliance = 0 AND53      su.UseForITShopCompliance = 1)) AND pwo.OrderState IN('OrderProduct', 'OrderProlongate', 'OrderUnsubscribe')) AS x54      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackPWOHelperPWO',55        @DBQueueElements_0156    END57    IF58    UPDATE(IsCurrentlyActive) OR59    UPDATE(UseForHeadOrg)60    BEGIN61      DECLARE @DBQueueElements_02 QBM_YDBQueueRaw62      INSERT INTO @DBQueueElements_02(object,63      subobject,64      genprocid)65      SELECT66        x.uid,67        NULL,68        @GenProcID69      FROM(70      SELECT d.UID_PersonReceiver AS uid71      FROM deleted d72      JOIN QERUniversalSubstitute su73        ON d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute74      WHERE75        ((d.IsCurrentlyActive <> su.IsCurrentlyActive) AND(d.UseForHeadOrg = 1 OR su.UseForHeadOrg = 1)) OR((d.UseForHeadOrg <> su.UseForHeadOrg76      ) AND(d.IsCurrentlyActive = 1 OR su.IsCurrentlyActive = 1))) AS x77      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadOrg',78        @DBQueueElements_0279    END80    IF81    UPDATE(IsCurrentlyActive) OR82    UPDATE(UseForHeadPerson)83    BEGIN84      DECLARE @DBQueueElements_03 QBM_YDBQueueRaw85      INSERT INTO @DBQueueElements_03(object,86      subobject,87      genprocid)88      SELECT89        x.uid,90        NULL,91        @GenProcID92      FROM(93      SELECT d.UID_PersonReceiver AS uid94      FROM deleted d95      JOIN QERUniversalSubstitute su96        ON d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute97      WHERE98        ((d.IsCurrentlyActive <> su.IsCurrentlyActive) AND(d.UseForHeadPerson = 1 OR su.UseForHeadPerson = 1)) OR((d.UseForHeadPerson <> su.UseForHeadPerson99      ) AND(d.IsCurrentlyActive = 1 OR su.IsCurrentlyActive = 1))) AS x100      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadPerson',101        @DBQueueElements_03102    END103  END TRY104  BEGIN CATCH105    EXEC QBM_PSessionErrorAdd DEFAULT106    RAISERROR('',107    18,108    1)109      WITH NOWAIT110  END CATCH111  ende:112  RETURN113END
Open raw exported source
SQL ยท Raw22 lines
1create   trigger QER_TUQERUniversalSubstitute on QERUniversalSubstitute  for Update not for Replication as begin declare @GenProcID varchar(38) 2= dbo.QBM_FGISessionContext('') BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return3 start: if update(IsCurrentlyActive) or UPDATE(UseForITShopCompliance) or UPDATE(UseForITShop) begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert4 into @DBQueueElements_01(object, subobject, genprocid) select x.uid, null, @GenProcID from(  select pwo.UID_PersonWantsOrg as uid from deleted d join 5QERUniversalSubstitute su on d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute join PWOHelperPWO h on su.UID_PersonReceiver = h.UID_PersonHead6 join PersonWantsOrg pwo on h.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg and h.LevelNumber = pwo.DecisionLevel where( (d.IsCurrentlyActive = 1 and su.IsCurrentlyActive7 = 0) or (d.UseForITShop = 1 and su.UseForITShop = 0) or (d.UseForITShopCompliance = 1 and su.UseForITShopCompliance = 0) ) and pwo.OrderState in ('OrderProduct'8, 'OrderProlongate', 'OrderUnsubscribe') union  select pwo.UID_PersonWantsOrg as uid from deleted d join QERUniversalSubstitute su on d.UID_QERUniversalSubstitute9 = su.UID_QERUniversalSubstitute join PWOHelperPWO h on d.UID_PersonSender = h.UID_PersonHead join PersonWantsOrg pwo on h.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg10 and h.LevelNumber = pwo.DecisionLevel where( (d.IsCurrentlyActive = 0 and su.IsCurrentlyActive = 1 ) or (d.UseForITShop = 0 and su.UseForITShop = 1) or11 (d.UseForITShopCompliance = 0 and su.UseForITShopCompliance = 1) ) and pwo.OrderState in ('OrderProduct', 'OrderProlongate', 'OrderUnsubscribe') ) as 12x exec QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackPWOHelperPWO' , @DBQueueElements_01 end  if update(IsCurrentlyActive) or UPDATE(UseForHeadOrg) begin 13declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02(object, subobject, genprocid) select x.uid, null, @GenProcID from(  select 14d.UID_PersonReceiver as uid from deleted d join QERUniversalSubstitute su on d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute where( (d.IsCurrentlyActive15 <> su.IsCurrentlyActive ) and (d.UseForHeadOrg = 1 or su.UseForHeadOrg = 1) ) or ( (d.UseForHeadOrg <> su.UseForHeadOrg) and (d.IsCurrentlyActive = 1 16or su.IsCurrentlyActive = 1 ) ) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadOrg', @DBQueueElements_02 end if update(IsCurrentlyActive) or UPDATE17(UseForHeadPerson) begin declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03(object, subobject, genprocid) select x.uid, null, 18@GenProcID from(  select d.UID_PersonReceiver as uid from deleted d join QERUniversalSubstitute su on d.UID_QERUniversalSubstitute = su.UID_QERUniversalSubstitute19 where( (d.IsCurrentlyActive <> su.IsCurrentlyActive ) and (d.UseForHeadPerson = 1 or su.UseForHeadPerson = 1) ) or ((d.UseForHeadPerson <> su.UseForHeadPerson20) and (d.IsCurrentlyActive = 1 or su.IsCurrentlyActive = 1 ) ) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadPerson', @DBQueueElements_03 end END21 TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 22