dbo.TSB_TUUNSRootB
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 -> TSB-K-BaseTreeOwnsObject / TSB_ZBaseTreeOwnsObject at line 29
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: UNSRootB
Typed Edges
- queues DBQueue task TSB_ZBaseTreeOwnsObject at line 29 Bulk DBQueue insert -> TSB-K-BaseTreeOwnsObject / TSB_ZBaseTreeOwnsObject at line 29
- trigger on table UNSRootB Trigger parent table: UNSRootB
- 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_PITShopHelperFill_Recalc source text reference
References
- dbo.QBM_FGISessionContext
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PSessionErrorAdd
- dbo.QER_PITShopHelperFill
- dbo.QER_PITShopHelperFill_Recalc
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger TSB_TUUNSRootB2 ON UNSRootB FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @Parameter nvarchar(1000)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 DECLARE @GenProcID varchar(38)18 SELECT @GenProcID = dbo.QBM_FGISessionContext('')19 IF20 UPDATE(UserContainsGroupList)21 BEGIN22 IF(EXISTS(23 SELECT TOP 1 124 FROM deleted d25 JOIN UNSRootB r26 ON d.UID_UNSRootB = r.UID_UNSRootB27 JOIN UNSAccountB a28 ON a.UID_UNSRootB = r.UID_UNSRootB29 JOIN UNSGroupB g30 ON a.UID_UNSRootB = r.UID_UNSRootB31 LEFT32 OUTER33 JOIN UNSAccountBInUNSGroupB uig34 ON a.UID_UNSAccountB = uig.UID_UNSAccountB AND g.UID_UNSGroupB = uig.UID_UNSGroupB35 LEFT36 OUTER37 JOIN UNSAccountBHasUNSGroupB uhg38 ON a.UID_UNSAccountB = uhg.UID_UNSAccountB AND g.UID_UNSGroupB = uhg.UID_UNSGroupB39 WHERE40 d.UserContainsGroupList & 0x01 <> r.UserContainsGroupList & 0x01 AND(uig.UID_UNSAccountB > ' ' OR uhg.UID_UNSAccountB > ' '))) OR(EXISTS41 (42 SELECT TOP 1 143 FROM deleted d44 JOIN UNSRootB r45 ON d.UID_UNSRootB = r.UID_UNSRootB46 JOIN UNSAccountB a47 ON a.UID_UNSRootB = r.UID_UNSRootB48 JOIN UNSGroupB1 g49 ON a.UID_UNSRootB = r.UID_UNSRootB50 LEFT51 OUTER52 JOIN UNSAccountBInUNSGroupB1 uig53 ON a.UID_UNSAccountB = uig.UID_UNSAccountB AND g.UID_UNSGroupB1 = uig.UID_UNSGroupB154 LEFT55 OUTER56 JOIN UNSAccountBHasUNSGroupB1 uhg57 ON a.UID_UNSAccountB = uhg.UID_UNSAccountB AND g.UID_UNSGroupB1 = uhg.UID_UNSGroupB158 WHERE59 d.UserContainsGroupList & 0x02 <> r.UserContainsGroupList & 0x02 AND(uig.UID_UNSAccountB > ' ' OR uhg.UID_UNSAccountB > ' '))) OR(EXISTS60 (61 SELECT TOP 1 162 FROM deleted d63 JOIN UNSRootB r64 ON d.UID_UNSRootB = r.UID_UNSRootB65 JOIN UNSAccountB a66 ON a.UID_UNSRootB = r.UID_UNSRootB67 JOIN UNSGroupB2 g68 ON a.UID_UNSRootB = r.UID_UNSRootB69 LEFT70 OUTER71 JOIN UNSAccountBInUNSGroupB2 uig72 ON a.UID_UNSAccountB = uig.UID_UNSAccountB AND g.UID_UNSGroupB2 = uig.UID_UNSGroupB273 LEFT74 OUTER75 JOIN UNSAccountBHasUNSGroupB2 uhg76 ON a.UID_UNSAccountB = uhg.UID_UNSAccountB AND g.UID_UNSGroupB2 = uhg.UID_UNSGroupB277 WHERE78 d.UserContainsGroupList & 0x04 <> r.UserContainsGroupList & 0x04 AND(uig.UID_UNSAccountB > ' ' OR uhg.UID_UNSAccountB > ' '))) OR(EXISTS79 (80 SELECT TOP 1 181 FROM deleted d82 JOIN UNSRootB r83 ON d.UID_UNSRootB = r.UID_UNSRootB84 JOIN UNSAccountB a85 ON a.UID_UNSRootB = r.UID_UNSRootB86 JOIN UNSGroupB3 g87 ON a.UID_UNSRootB = r.UID_UNSRootB88 LEFT89 OUTER90 JOIN UNSAccountBInUNSGroupB3 uig91 ON a.UID_UNSAccountB = uig.UID_UNSAccountB AND g.UID_UNSGroupB3 = uig.UID_UNSGroupB392 LEFT93 OUTER94 JOIN UNSAccountBHasUNSGroupB3 uhg95 ON a.UID_UNSAccountB = uhg.UID_UNSAccountB AND g.UID_UNSGroupB3 = uhg.UID_UNSGroupB396 WHERE97 d.UserContainsGroupList & 0x08 <> r.UserContainsGroupList & 0x08 AND(uig.UID_UNSAccountB > ' ' OR uhg.UID_UNSAccountB > ' ')))98 BEGIN99 RAISERROR('#LDS#Change of {0} not allowed because of existing data.|UserContainsGroupList|',100 18,101 1)102 WITH nowait103 END104 END105 IF106 UPDATE(GroupUsageMask)107 BEGIN108 IF((EXISTS(109 SELECT TOP 1 1110 FROM deleted d111 JOIN UNSRootB r112 ON d.UID_UNSRootB = r.UID_UNSRootB113 JOIN UNSGroupB g114 ON r.UID_UNSRootB = g.UID_UNSRootB115 WHERE116 d.GroupUsageMask & 0x01 > 0 AND r.GroupUsageMask & 0x01 = 0)) OR(EXISTS(117 SELECT TOP 1 1118 FROM deleted d119 JOIN UNSRootB r120 ON d.UID_UNSRootB = r.UID_UNSRootB121 JOIN UNSGroupB1 g122 ON r.UID_UNSRootB = g.UID_UNSRootB123 WHERE124 d.GroupUsageMask & 0x02 > 0 AND r.GroupUsageMask & 0x02 = 0)) OR(EXISTS(125 SELECT TOP 1 1126 FROM deleted d127 JOIN UNSRootB r128 ON d.UID_UNSRootB = r.UID_UNSRootB129 JOIN UNSGroupB2 g130 ON r.UID_UNSRootB = g.UID_UNSRootB131 WHERE132 d.GroupUsageMask & 0x04 > 0 AND r.GroupUsageMask & 0x04 = 0)) OR(EXISTS(133 SELECT TOP 1 1134 FROM deleted d135 JOIN UNSRootB r136 ON d.UID_UNSRootB = r.UID_UNSRootB137 JOIN UNSGroupB3 g138 ON r.UID_UNSRootB = g.UID_UNSRootB139 WHERE140 d.GroupUsageMask & 0x08 > 0 AND r.GroupUsageMask & 0x08 = 0)))141 BEGIN142 RAISERROR('#LDS#Change of {0} not allowed because of existing data.|GroupUsageMask|',143 18,144 1)145 WITH nowait146 END147 END148 IF149 UPDATE(uid_AERoleOwner)150 BEGIN151 DECLARE @RecalcParameter_01 QBM_YCursorBuffer152 INSERT INTO @RecalcParameter_01(UID1,153 ObjectKey1,154 Ident1)155 SELECT156 'TSB-PWODecisionRule-TO',157 i.XObjectKey,158 'I'159 FROM inserted i160 UNION all161 SELECT162 'QER-PWODecisionRule-OX',163 i.XObjectKey,164 'I'165 FROM inserted i166 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_01,167 @GenprocID168 END169 IF170 UPDATE(uid_AERoleOwner)171 BEGIN172 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw173 INSERT INTO @DBQueueElements_02(object,174 subobject,175 genprocid)176 SELECT177 x.uid,178 NULL,179 @GenProcID180 FROM(181 SELECT d.UID_UNSRootB AS uid182 FROM deleted d) AS x183 EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-BaseTreeOwnsObject',184 @DBQueueElements_02185 END186 END TRY187 BEGIN CATCH188 EXEC QBM_PSessionErrorAdd DEFAULT189 RAISERROR('',190 18,191 1)192 WITH NOWAIT193 END CATCH194 ende:195 RETURN196END
Open raw exported source
1create trigger TSB_TUUNSRootB on UNSRootB for Update not for Replication as begin declare @Parameter nvarchar(1000) BEGIN TRY if exists (select2 top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = 3dbo.QBM_FGISessionContext('') if update(UserContainsGroupList) begin if (exists (select top 1 1 from deleted d join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB4 join UNSAccountB a on a.UID_UNSRootB = r.UID_UNSRootB join UNSGroupB g on a.UID_UNSRootB = r.UID_UNSRootB left outer join UNSAccountBInUNSGroupB uig on5 a.UID_UNSAccountB = uig.UID_UNSAccountB and g.UID_UNSGroupB = uig.UID_UNSGroupB left outer join UNSAccountBHasUNSGroupB uhg on a.UID_UNSAccountB = uhg.UID_UNSAccountB6 and g.UID_UNSGroupB = uhg.UID_UNSGroupB where d.UserContainsGroupList & 0x01 <> r.UserContainsGroupList & 0x01 and ( uig.UID_UNSAccountB > ' ' or uhg.UID_UNSAccountB7 > ' ' ) ) ) or (exists (select top 1 1 from deleted d join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB join UNSAccountB a on a.UID_UNSRootB = r.UID_UNSRootB8 join UNSGroupB1 g on a.UID_UNSRootB = r.UID_UNSRootB left outer join UNSAccountBInUNSGroupB1 uig on a.UID_UNSAccountB = uig.UID_UNSAccountB and g.UID_UNSGroupB19 = uig.UID_UNSGroupB1 left outer join UNSAccountBHasUNSGroupB1 uhg on a.UID_UNSAccountB = uhg.UID_UNSAccountB and g.UID_UNSGroupB1 = uhg.UID_UNSGroupB110 where d.UserContainsGroupList & 0x02 <> r.UserContainsGroupList & 0x02 and ( uig.UID_UNSAccountB > ' ' or uhg.UID_UNSAccountB > ' ' ) ) ) or (exists (select11 top 1 1 from deleted d join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB join UNSAccountB a on a.UID_UNSRootB = r.UID_UNSRootB join UNSGroupB2 g on a.UID_UNSRootB12 = r.UID_UNSRootB left outer join UNSAccountBInUNSGroupB2 uig on a.UID_UNSAccountB = uig.UID_UNSAccountB and g.UID_UNSGroupB2 = uig.UID_UNSGroupB2 left13 outer join UNSAccountBHasUNSGroupB2 uhg on a.UID_UNSAccountB = uhg.UID_UNSAccountB and g.UID_UNSGroupB2 = uhg.UID_UNSGroupB2 where d.UserContainsGroupList14 & 0x04 <> r.UserContainsGroupList & 0x04 and ( uig.UID_UNSAccountB > ' ' or uhg.UID_UNSAccountB > ' ' ) ) ) or (exists (select top 1 1 from deleted d 15join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB join UNSAccountB a on a.UID_UNSRootB = r.UID_UNSRootB join UNSGroupB3 g on a.UID_UNSRootB = r.UID_UNSRootB16 left outer join UNSAccountBInUNSGroupB3 uig on a.UID_UNSAccountB = uig.UID_UNSAccountB and g.UID_UNSGroupB3 = uig.UID_UNSGroupB3 left outer join UNSAccountBHasUNSGroupB317 uhg on a.UID_UNSAccountB = uhg.UID_UNSAccountB and g.UID_UNSGroupB3 = uhg.UID_UNSGroupB3 where d.UserContainsGroupList & 0x08 <> r.UserContainsGroupList18 & 0x08 and ( uig.UID_UNSAccountB > ' ' or uhg.UID_UNSAccountB > ' ' ) ) ) begin raiserror('#LDS#Change of {0} not allowed because of existing data.|UserContainsGroupList|'19, 18, 1) with nowait end end if update(GroupUsageMask) begin if ( (exists (select top 1 1 from deleted d join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB20 join UNSGroupB g on r.UID_UNSRootB = g.UID_UNSRootB where d.GroupUsageMask & 0x01 > 0 and r.GroupUsageMask & 0x01 = 0 ) ) or (exists (select top 1 1 from21 deleted d join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB join UNSGroupB1 g on r.UID_UNSRootB = g.UID_UNSRootB where d.GroupUsageMask & 0x02 > 0 and22 r.GroupUsageMask & 0x02 = 0 ) ) or (exists (select top 1 1 from deleted d join UNSRootB r on d.UID_UNSRootB = r.UID_UNSRootB join UNSGroupB2 g on r.UID_UNSRootB23 = g.UID_UNSRootB where d.GroupUsageMask & 0x04 > 0 and r.GroupUsageMask & 0x04 = 0 ) ) or (exists (select top 1 1 from deleted d join UNSRootB r on d.UID_UNSRootB24 = r.UID_UNSRootB join UNSGroupB3 g on r.UID_UNSRootB = g.UID_UNSRootB where d.GroupUsageMask & 0x08 > 0 and r.GroupUsageMask & 0x08 = 0 ) ) ) begin raiserror25('#LDS#Change of {0} not allowed because of existing data.|GroupUsageMask|', 18, 1) with nowait end end if update(uid_AERoleOwner) begin declare @RecalcParameter_0126 QBM_YCursorBuffer insert into @RecalcParameter_01 (UID1, ObjectKey1, Ident1) select 'TSB-PWODecisionRule-TO', i.XObjectKey, 'I' from inserted i union 27all select 'QER-PWODecisionRule-OX', i.XObjectKey, 'I' from inserted i exec QER_PITShopHelperFill_Recalc @RecalcParameter_01, @GenprocID end if update28(uid_AERoleOwner) begin declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, 29@GenProcID from ( select d.UID_UNSRootB as uid from deleted d ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-BaseTreeOwnsObject', @DBQueueElements_02 end END30 TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 31