dbo.CPL_TUPerson
Database TriggerSQL_TRIGGERSandbox DB
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 -> CPL-K-ComplianceSubRuleFillPersonS / CPL_ZSubRuleFillPersonS at line 10
- Bulk DBQueue insert -> CPL-K-ComplianceCheckForPerson / CPL_ZComplianceCheckForPerson at line 10
- Bulk DBQueue insert -> CPL-K-ComplianceCheckForPerson / CPL_ZComplianceCheckForPerson at line 11
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: Person
Typed Edges
- queues DBQueue task CPL_ZSubRuleFillPersonS at line 10 Bulk DBQueue insert -> CPL-K-ComplianceSubRuleFillPersonS / CPL_ZSubRuleFillPersonS at line 10
- queues DBQueue task CPL_ZComplianceCheckForPerson at line 10 Bulk DBQueue insert -> CPL-K-ComplianceCheckForPerson / CPL_ZComplianceCheckForPerson at line 10
- queues DBQueue task CPL_ZComplianceCheckForPerson at line 11 Bulk DBQueue insert -> CPL-K-ComplianceCheckForPerson / CPL_ZComplianceCheckForPerson at line 11
- trigger on table Person Trigger parent table: Person
- references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
- references source dbo.QBM_FGIColumnUpdatedOthers source text reference
- references source dbo.QBM_FGIConfigparmValue 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
- references source dbo.QER_PITShopHelperFill source text reference
- references source dbo.QER_PITShopHelperFillAll source text reference
Complete Source
1CREATE trigger CPL_TUPerson2 ON Person FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @Parameter nvarchar(1000)7 DECLARE @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',8 0)9 BEGIN TRY10 IF EXISTS(11 SELECT TOP 1 112 FROM inserted)13 GOTO start14 IF EXISTS(15 SELECT TOP 1 116 FROM deleted)17 GOTO start18 RETURN start:19 DECLARE @GenProcID varchar(38) = dbo.QBM_FGISessionContext('')20 DECLARE @ValidRules QBM_YParameterList21 IF dbo.QBM_FGIColumnUpdatedOthers('Person',22 'XTouched',23 columns_updated()) = 1 AND(dbo.QBM_FGIColumnUpdatedOthers('Person', 'XMarkedForDeletion', columns_updated()) = 1 OR EXISTS(24 SELECT TOP 1 125 FROM deleted i26 JOIN person p27 ON i.uid_person = p.uid_person28 WHERE29 sign(i.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay) <> sign(p.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay)))30 BEGIN31 IF '1' = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\CalculateImmediately')32 BEGIN33 INSERT INTO @ValidRules(Parameter1)34 SELECT r.UID_ComplianceRule35 FROM ComplianceRule r36 WHERE37 r.IsInactive = 0 AND r.IsWorkingCopy = 0 AND(r.IsPersonStoreInverted = 0 OR(r.IsPersonStoreInverted = 1 AND N '1=1' <> replace(trim(isnull38 (r.WhereClausePerson, N '1=1')), N ' ', N '')))39 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw40 INSERT INTO @DBQueueElements_01(object,41 subobject,42 genprocid)43 SELECT44 x.uid,45 x.UID_Person,46 @GenProcID47 FROM(48 SELECT49 c.Parameter1 AS uid,50 i.UID_Person51 FROM inserted i,52 @ValidRules c) AS x53 EXEC QBM_PDBQueueInsert_Bulk 'CPL-K-ComplianceSubRuleFillPersonS',54 @DBQueueElements_0155 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw56 INSERT INTO @DBQueueElements_02(object,57 subobject,58 genprocid)59 SELECT60 x.uid,61 NULL,62 @GenProcID63 FROM(64 SELECT m.uid_person AS uid65 FROM deleted m) AS x66 EXEC QBM_PDBQueueInsert_Bulk 'CPL-K-ComplianceCheckForPerson',67 @DBQueueElements_0268 END69 END70 IF71 UPDATE(uid_department) OR72 UPDATE(uid_ProfitCenter) OR73 UPDATE(uid_Locality)74 BEGIN75 SELECT @Parameter = '|' + 'CPL-PWODecisionRule-OC|' + 'CPL-PWODecisionRule-OH|'76 EXEC QER_PITShopHelperFillAll @Parameter,77 @GenProcID78 END79 END TRY80 BEGIN CATCH81 EXEC QBM_PSessionErrorAdd DEFAULT82 RAISERROR('',83 18,84 1)85 WITH NOWAIT86 END CATCH87 ende:88 RETURN89END
Open raw exported source
1create trigger CPL_TUPerson on Person for Update not for Replication as begin declare @Parameter nvarchar(1000) declare @QBM_BitPatternXMarkedForDel_Delay2 int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|', 0) BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted3) goto start return start: declare @GenProcID varchar(38) = dbo.QBM_FGISessionContext('') declare @ValidRules QBM_YParameterList if dbo.QBM_FGIColumnUpdatedOthers4 ('Person', 'XTouched', columns_updated()) = 1 and (dbo.QBM_FGIColumnUpdatedOthers ('Person', 'XMarkedForDeletion', columns_updated()) = 1 or exists (select5 top 1 1 from deleted i join person p on i.uid_person = p.uid_person where sign(i.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay) <> sign(p.XMarkedForDeletion6 & @QBM_BitPatternXMarkedForDel_Delay) ) ) begin if '1' = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\CalculateImmediately') begin insert into @ValidRules7 (Parameter1) select r.UID_ComplianceRule from ComplianceRule r where r.IsInactive = 0 and r.IsWorkingCopy = 0 and ( r.IsPersonStoreInverted = 0 or (r.IsPersonStoreInverted8 = 1 and N'1=1' <> replace(trim(isnull(r.WhereClausePerson, N'1=1')) , N' ' , N'') ) ) declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_019 (object, subobject, genprocid) select x.uid, x.UID_Person, @GenProcID from ( select c.Parameter1 as uid, i.UID_Person from inserted i , @ValidRules c 10) as x exec QBM_PDBQueueInsert_Bulk 'CPL-K-ComplianceSubRuleFillPersonS', @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_0211 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select m.uid_person as uid from deleted m ) as x exec QBM_PDBQueueInsert_Bulk12 'CPL-K-ComplianceCheckForPerson', @DBQueueElements_02 end end if update(uid_department) or update(uid_ProfitCenter) or update(uid_Locality) begin select13 @Parameter = '|' + 'CPL-PWODecisionRule-OC|' + 'CPL-PWODecisionRule-OH|' exec QER_PITShopHelperFillAll @Parameter, @GenProcID end END TRY BEGIN CATCH14 exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 15