dbo.RPS_TURPSSubscription
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-PersonHasObject / RPS_ZPersonHasObject at line 11
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: RPSSubscription
Typed Edges
- queues DBQueue task RPS_ZPersonHasObject at line 11 Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 11
- trigger on table RPSSubscription Trigger parent table: RPSSubscription
- 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
1CREATE trigger RPS_TURPSSubscription2 ON RPSSubscription FOR3UPDATE NOT FOR Replication4AS5BEGIN6 BEGIN TRY7 IF EXISTS(8 SELECT TOP 1 19 FROM inserted)10 GOTO start11 IF EXISTS(12 SELECT TOP 1 113 FROM deleted)14 GOTO start15 RETURN start:16 DECLARE @GenProcID varchar(38)17 SELECT @GenProcID = dbo.QBM_FGISessionContext('')18 IF19 UPDATE(UID_Person) OR20 UPDATE(UID_RPSReport)21 BEGIN22 IF EXISTS(23 SELECT TOP 1 124 FROM inserted i25 JOIN RPSSubscription s26 ON i.UID_RPSSubscription = s.UID_RPSSubscription27 LEFT28 OUTER29 JOIN PersonHasRPSReport t30 ON t.uid_RPSReport = s.UID_RPSReport AND t.UID_Person = s.UID_Person AND t.XOrigin > 031 WHERE32 t.uid_person IS NULL)33 BEGIN34 RAISERROR('#LDS#Assignment is not permitted due to missing combination of person and report.|',35 18,36 2)37 WITH nowait38 END39 END40 IF41 UPDATE(isRejected)42 BEGIN43 IF EXISTS(44 SELECT TOP 1 145 FROM deleted d46 JOIN RPSSubscription s47 ON d.UID_RPSSubscription = s.UID_RPSSubscription AND d.isRejected = 1 AND isnull(s.isRejected, 0) = 048 LEFT49 OUTER50 JOIN PersonHasRPSReport t51 ON t.uid_RPSReport = s.UID_RPSReport AND t.UID_Person = s.UID_Person AND t.XOrigin > 052 WHERE53 t.uid_person IS NULL)54 BEGIN55 RAISERROR('#LDS#Assignment is not permitted due to missing combination of person and report.|',56 18,57 2)58 WITH nowait59 END60 END61 IF62 UPDATE(UID_Person)63 BEGIN64 DECLARE @DBQueueElements_PHO QBM_YDBQueueRaw65 INSERT INTO @DBQueueElements_PHO(object,66 subobject,67 genprocid)68 SELECT69 x.uid,70 NULL,71 @GenProcID72 FROM(73 SELECT74 DISTINCT d.UID_Person AS uid75 FROM deleted d76 JOIN RPSSubscription r77 ON d.UID_RPSSubscription = r.UID_RPSSubscription78 WHERE79 isnull(d.UID_Person, '') <> isnull(r.UID_Person, '')) AS x80 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasObject',81 @DBQueueElements_PHO82 END83 END TRY84 BEGIN CATCH85 EXEC QBM_PSessionErrorAdd DEFAULT86 RAISERROR('',87 18,88 1)89 WITH NOWAIT90 END CATCH91 ende:92 RETURN93END
Open raw exported source
1create trigger RPS_TURPSSubscription on RPSSubscription for update not for Replication as begin BEGIN TRY if exists (select top 1 1 from inserted2) goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext3('') if update(UID_Person) or update(UID_RPSReport) begin if exists (select top 1 1 from inserted i join RPSSubscription s on i.UID_RPSSubscription = s.UID_RPSSubscription4 left outer join PersonHasRPSReport t on t.uid_RPSReport = s.UID_RPSReport and t.UID_Person = s.UID_Person and t.XOrigin > 0 where t.uid_person is null5 ) begin raiserror ('#LDS#Assignment is not permitted due to missing combination of person and report.|', 18, 2) with nowait end end if update(isRejected6) begin if exists (select top 1 1 from deleted d join RPSSubscription s on d.UID_RPSSubscription = s.UID_RPSSubscription and d.isRejected = 1 and isnull7(s.isRejected, 0) = 0 left outer join PersonHasRPSReport t on t.uid_RPSReport = s.UID_RPSReport and t.UID_Person = s.UID_Person and t.XOrigin > 0 where8 t.uid_person is null ) begin raiserror ('#LDS#Assignment is not permitted due to missing combination of person and report.|', 18, 2) with nowait end 9end if update(UID_Person) begin declare @DBQueueElements_PHO QBM_YDBQueueRaw insert into @DBQueueElements_PHO (object, subobject, genprocid) select x.uid10, null, @GenProcID from ( select distinct d.UID_Person as uid from deleted d join RPSSubscription r on d.UID_RPSSubscription = r.UID_RPSSubscription where11 isnull(d.UID_Person, '') <> isnull(r.UID_Person, '') ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasObject', @DBQueueElements_PHO end END TRY BEGIN12 CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 13