dbo.RPS_TUPersonHasRPSReport
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 -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 6
- Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 6
- Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 9
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: PersonHasRPSReport
Typed Edges
- queues DBQueue task RPS_ZPersonHasRPSReport at line 6 Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 6
- queues DBQueue task RPS_ZPersonHasObject at line 6 Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 6
- queues DBQueue task RPS_ZPersonHasObject at line 9 Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 9
- trigger on table PersonHasRPSReport Trigger parent table: PersonHasRPSReport
- 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
- dbo.QBM_FGISessionContext
- dbo.QBM_FGIXOriginChanged_Effect
- dbo.QBM_FGIXOriginChanged_Except2
- dbo.QER_FCVXOriginToInheritInfo
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PSessionErrorAdd
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger RPS_TUPersonHasRPSReport2 ON PersonHasRPSReport FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @XUser nvarchar(64) = object_name(@@procid)7 DECLARE @Xdate datetime = getutcdate()8 BEGIN TRY9 IF EXISTS(10 SELECT TOP 1 111 FROM inserted)12 GOTO start13 IF EXISTS(14 SELECT TOP 1 115 FROM deleted)16 GOTO start17 RETURN start:18 DECLARE @GenProcID varchar(38)19 SELECT @GenProcID = dbo.QBM_FGISessionContext('')20 IF21 UPDATE(XOrigin)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 SELECT33 DISTINCT d.UID_Person AS uid34 FROM deleted d35 JOIN PersonHasRPSReport dd36 ON d.XObjectKey = dd.XObjectKey37 WHERE38 dbo.QBM_FGIXOriginChanged_Except2(d.XOrigin, dd.XOrigin) = 1) AS x39 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport',40 @DBQueueElements_0141 END42 IF43 UPDATE(XIsInEffect) OR44 UPDATE(XOrigin)45 BEGIN46 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw47 INSERT INTO @DBQueueElements_02(object,48 subobject,49 genprocid)50 SELECT51 x.uid,52 NULL,53 @GenProcID54 FROM(55 SELECT56 DISTINCT a.UID_Person AS uid57 FROM PersonHasRPSReport a58 JOIN deleted d59 ON a.XObjectKey = d.XObjectKey60 WHERE61 (dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 OR dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <>62 dbo.QER_FCVXOriginToInheritInfo(a.XOrigin))) AS x63 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasObject',64 @DBQueueElements_0265 END66 IF67 UPDATE(XIsInEffect) OR68 UPDATE(XOrigin)69 BEGIN70 UPDATE RPSSubscription71 SET isRejected = 0,72 XDateUpdated = @Xdate,73 XUserUpdated = @XUser74 WHERE75 EXISTS(76 SELECT TOP 1 177 FROM deleted d78 JOIN PersonHasRPSReport phr79 ON d.XObjectKey = phr.XObjectKey80 WHERE81 d.uid_person = RPSSubscription.uid_person AND d.uid_RPSReport = RPSSubscription.uid_RPSReport AND d.XIsInEffect = 0 AND phr.XIsInEffect82 = 1) AND isRejected = 183 UPDATE RPSSubscription84 SET isRejected = 1,85 XDateUpdated = @Xdate,86 XUserUpdated = @XUser87 WHERE88 EXISTS(89 SELECT TOP 1 190 FROM deleted d91 JOIN PersonHasRPSReport phr92 ON d.XObjectKey = phr.XObjectKey93 WHERE94 d.uid_person = RPSSubscription.uid_person AND d.uid_RPSReport = RPSSubscription.uid_RPSReport AND((d.XIsInEffect = 1 AND phr.XIsInEffect95 = 0) OR(d.XOrigin > 0 AND phr.XOrigin = 0))) AND isRejected = 096 END97 END TRY98 BEGIN CATCH99 EXEC QBM_PSessionErrorAdd DEFAULT100 RAISERROR('',101 18,102 1)103 WITH NOWAIT104 END CATCH105 ende:106 RETURN107END
Open raw exported source
1create trigger RPS_TUPersonHasRPSReport on PersonHasRPSReport for Update not for Replication as begin declare @XUser nvarchar(64) = object_name2(@@procid) declare @Xdate datetime = getutcdate() BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted)3 goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if update(XOrigin) begin declare @DBQueueElements_014 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct d.UID_Person as uid5 from deleted d join PersonHasRPSReport dd on d.XObjectKey = dd.XObjectKey where dbo.QBM_FGIXOriginChanged_Except2(d.XOrigin, dd.XOrigin) = 1 ) as x exec6 QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport', @DBQueueElements_01 end if update(XIsInEffect) or update(XOrigin) begin declare @DBQueueElements_027 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct a.UID_Person as uid8 from PersonHasRPSReport a join deleted d on a.XObjectKey = d.XObjectKey where ( dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, 9a.XIsInEffect) = 1 or dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(a.XOrigin) ) ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasObject'10, @DBQueueElements_02 end if update(XIsInEffect) or update(XOrigin) begin update RPSSubscription set isRejected = 0 , XDateUpdated = @Xdate , XUserUpdated11 = @XUser where exists (select top 1 1 from deleted d join PersonHasRPSReport phr on d.XObjectKey = phr.XObjectKey where d.uid_person = RPSSubscription.uid_person12 and d.uid_RPSReport = RPSSubscription.uid_RPSReport and d.XIsInEffect = 0 and phr.XIsInEffect = 1 ) and isRejected = 1 update RPSSubscription set isRejected13 = 1 , XDateUpdated = @Xdate , XUserUpdated = @XUser where exists (select top 1 1 from deleted d join PersonHasRPSReport phr on d.XObjectKey = phr.XObjectKey14 where d.uid_person = RPSSubscription.uid_person and d.uid_RPSReport = RPSSubscription.uid_RPSReport and ( (d.XIsInEffect = 1 and phr.XIsInEffect = 0) 15 or (d.XOrigin > 0 and phr.XOrigin = 0) ) ) and isRejected = 0 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT16 END CATCH ende: return end 17