dbo.RPS_TIPersonHasRPSReport
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 9
- Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 9
- Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 11
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: PersonHasRPSReport
Typed Edges
- queues DBQueue task RPS_ZPersonHasRPSReport at line 9 Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 9
- queues DBQueue task RPS_ZPersonHasObject at line 9 Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 9
- queues DBQueue task RPS_ZPersonHasObject at line 11 Bulk DBQueue insert -> RPS-K-PersonHasObject / RPS_ZPersonHasObject at line 11
- trigger on table PersonHasRPSReport Trigger parent table: PersonHasRPSReport
- references source dbo.QBM_FGIBitPatternXOrigin source text reference
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QER_FGIITShopFlagCombineValid source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
References
- dbo.QBM_FGIBitPatternXOrigin
- dbo.QBM_FGISessionContext
- dbo.QER_FGIITShopFlagCombineValid
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PSessionErrorAdd
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger RPS_TIPersonHasRPSReport2 ON PersonHasRPSReport FOR3INSERT NOT FOR Replication4AS5BEGIN6 DECLARE @XUser nvarchar(64) = object_name(@@procid)7 DECLARE @Xdate datetime = getutcdate()8 DECLARE @QBM_BitPatternXOrigin_Direct int = dbo.QBM_FGIBitPatternXOrigin('|Direct|',9 0)10 BEGIN TRY11 IF EXISTS(12 SELECT TOP 1 113 FROM inserted)14 GOTO start15 RETURN start:16 DECLARE @GenProcID varchar(38)17 SELECT @GenProcID = dbo.QBM_FGISessionContext('')18 IF EXISTS(19 SELECT TOP 1 120 FROM inserted i21 JOIN RPSReport p22 ON i.UID_RPSReport = p.UID_RPSReport AND p.isInactive = 1)23 BEGIN24 RAISERROR('#LDS#Assignment cannot take place, because the object to be assigned is disabled.|',25 18,26 3)27 WITH nowait28 END29 IF EXISTS(30 SELECT TOP 1 131 FROM inserted i32 JOIN RPSReport elem33 ON i.uid_RPSReport = elem.uid_RPSReport34 WHERE35 dbo.QER_FGIITShopFlagCombineValid(i.XObjectKey, NULL, NULL, elem.XObjectKey, elem.IsForITShop, elem.IsITShopOnly) = 0 AND i.XOrigin & @QBM_BitPatternXOrigin_Direct36 > 0)37 BEGIN38 RAISERROR('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|',39 18,40 2)41 WITH nowait42 END43 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw44 INSERT INTO @DBQueueElements_01(object,45 subobject,46 genprocid)47 SELECT48 x.uid,49 NULL,50 @GenProcID51 FROM(52 SELECT53 DISTINCT i.UID_Person AS uid54 FROM inserted i55 WHERE56 i.XIsInEffect = 0) AS x57 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport',58 @DBQueueElements_0159 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw60 INSERT INTO @DBQueueElements_02(object,61 subobject,62 genprocid)63 SELECT64 x.uid,65 NULL,66 @GenProcID67 FROM(68 SELECT69 DISTINCT uid_person AS uid70 FROM inserted i71 WHERE72 i.XIsInEffect = 1) AS x73 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasObject',74 @DBQueueElements_0275 UPDATE RPSSubscription76 SET isRejected = 0,77 XDateUpdated = @Xdate,78 XUserUpdated = @XUser79 WHERE80 EXISTS(81 SELECT TOP 1 182 FROM inserted d83 WHERE84 d.uid_person = RPSSubscription.uid_person AND d.uid_RPSReport = RPSSubscription.uid_RPSReport AND d.XIsInEffect = 1) AND isRejected = 185 END TRY86 BEGIN CATCH87 EXEC QBM_PSessionErrorAdd DEFAULT88 RAISERROR('',89 18,90 1)91 WITH NOWAIT92 END CATCH93 ende:94 RETURN95END
Open raw exported source
1 create trigger RPS_TIPersonHasRPSReport on PersonHasRPSReport for Insert not for Replication as begin declare @XUser nvarchar(64) = object_name2(@@procid) declare @Xdate datetime = getutcdate() declare @QBM_BitPatternXOrigin_Direct int = dbo.QBM_FGIBitPatternXOrigin('|Direct|', 0) BEGIN TRY if3 exists (select top 1 1 from inserted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if exists4 (select top 1 1 from inserted i join RPSReport p on i.UID_RPSReport = p.UID_RPSReport and p.isInactive = 1 ) begin raiserror( '#LDS#Assignment cannot take place, because the object to be assigned is disabled.|'5, 18, 3) with nowait end if exists (select top 1 1 from inserted i join RPSReport elem on i.uid_RPSReport = elem.uid_RPSReport where dbo.QER_FGIITShopFlagCombineValid6(i.XObjectKey, null, null, elem.XObjectKey, elem.IsForITShop, elem.IsITShopOnly) = 0 and i.XOrigin & @QBM_BitPatternXOrigin_Direct > 0 ) begin raiserror7 ('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|', 18, 2) with nowait end declare @DBQueueElements_01 QBM_YDBQueueRaw insert8 into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct i.UID_Person as uid from inserted i where9 i.XIsInEffect = 0 ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport', @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert10 into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct uid_person as uid from inserted i where 11i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasObject', @DBQueueElements_02 update RPSSubscription set isRejected = 0 , XDateUpdated12 = @Xdate , XUserUpdated = @XUser where exists (select top 1 1 from inserted d where d.uid_person = RPSSubscription.uid_person and d.uid_RPSReport = RPSSubscription.uid_RPSReport13 and d.XIsInEffect = 1 ) and isRejected = 1 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return14 end 15