dbo.ADS_TDAdsGroup
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 -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 10
- Bulk DBQueue insert -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 10
- Bulk DBQueue insert -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 13
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: ADSGroup
Typed Edges
- queues DBQueue task ADS_ZPersonHasObject at line 10 Bulk DBQueue insert -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 10
- queues DBQueue task ADS_ZPersonHasObject at line 13 Bulk DBQueue insert -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 13
- trigger on table ADSGroup Trigger parent table: ADSGroup
- references source dbo.QBM_FCVElementToObjectKey1 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
Complete Source
1CREATE trigger ADS_TDAdsGroup2 ON AdsGroup FOR3DELETE NOT FOR Replication4AS5BEGIN6 BEGIN TRY7 IF EXISTS(8 SELECT TOP 1 19 FROM deleted)10 GOTO start11 RETURN start:12 DECLARE @GenProcID varchar(38) = dbo.QBM_FGISessionContext('')13 IF EXISTS(14 SELECT TOP 1 115 FROM deleted d16 WHERE17 d.ObjectSID > ' ')18 BEGIN19 INSERT INTO ADSOtherSID(UID_ADSOtherSID,20 ObjectSID,21 DistinguishedName,22 canonicalName,23 Ident_ADSOtherSID,24 XDateInserted,25 XDateUpdated,26 XUserInserted,27 XUserUpdated,28 XObjectKey)29 SELECT30 x.UID_ADSOtherSID,31 x.ObjectSID,32 x.DistinguishedName,33 x.canonicalName,34 x.Ident_ADSOtherSID,35 x.XDateInserted,36 x.XDateUpdated,37 x.XUserInserted,38 x.XUserUpdated,39 dbo.QBM_FCVElementToObjectKey1('ADSOtherSID',40 'UID_ADSOtherSID',41 x.UID_ADSOtherSID)42 FROM(43 SELECT44 newid() AS UID_ADSOtherSID,45 d.ObjectSID,46 d.DistinguishedName,47 d.canonicalName,48 d.cn AS Ident_ADSOtherSID,49 d.XDateInserted,50 d.XDateUpdated,51 d.XUserInserted,52 d.XUserUpdated53 FROM deleted d54 WHERE55 d.ObjectSID > ' ' AND NOT EXISTS(56 SELECT TOP 1 157 FROM ADSOtherSID x58 WHERE59 x.ObjectSID = d.ObjectSID)) AS x60 END61 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw62 INSERT INTO @DBQueueElements_01(object,63 subobject,64 genprocid)65 SELECT66 x.uid,67 NULL,68 @GenProcID69 FROM(70 SELECT71 DISTINCT a.uid_person AS uid72 FROM adsaccountinadsgroup aig73 JOIN adsaccount a74 ON aig.uid_adsaccount = a.uid_adsaccount AND aig.XOrigin > 075 JOIN deleted g76 ON aig.uid_adsGroup = g.uid_adsGroup77 WHERE78 a.uid_person > ' ') AS x79 EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-PersonHasObject',80 @DBQueueElements_0181 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw82 INSERT INTO @DBQueueElements_02(object,83 subobject,84 genprocid)85 SELECT86 x.uid,87 NULL,88 @GenProcID89 FROM(90 SELECT91 DISTINCT a.uid_person AS uid92 FROM ADSContactInADSGroup aig93 JOIN ADSContact a94 ON aig.UID_ADSContact = a.uid_ADSContact AND aig.XOrigin > 095 JOIN deleted g96 ON aig.uid_adsGroup = g.uid_adsGroup97 WHERE98 a.uid_person > ' ') AS x99 EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-PersonHasObject',100 @DBQueueElements_02101 END TRY102 BEGIN CATCH103 EXEC QBM_PSessionErrorAdd DEFAULT104 RAISERROR('',105 18,106 1)107 WITH NOWAIT108 END CATCH109 ende:110 RETURN111END
Open raw exported source
1 create trigger ADS_TDAdsGroup on AdsGroup for Delete not for Replication as begin BEGIN TRY if exists (select top 1 1 from deleted) goto2 start return start: declare @GenProcID varchar(38) = dbo.QBM_FGISessionContext('') if exists (select top 1 1 from deleted d where d.ObjectSID > ' ' )3 begin insert into ADSOtherSID (UID_ADSOtherSID, ObjectSID , DistinguishedName, canonicalName, Ident_ADSOtherSID , XDateInserted, XDateUpdated, XUserInserted4, XUserUpdated, XObjectKey) select x.UID_ADSOtherSID, x.ObjectSID , x.DistinguishedName, x.canonicalName, x.Ident_ADSOtherSID , x.XDateInserted, x.XDateUpdated5, x.XUserInserted, x.XUserUpdated, dbo.QBM_FCVElementToObjectKey1('ADSOtherSID', 'UID_ADSOtherSID', x.UID_ADSOtherSID) from ( select newid() as UID_ADSOtherSID6, d.ObjectSID , d.DistinguishedName, d.canonicalName, d.cn as Ident_ADSOtherSID , d.XDateInserted, d.XDateUpdated, d.XUserInserted, d.XUserUpdated from7 deleted d where d.ObjectSID > ' ' and not exists (select top 1 1 from ADSOtherSID x where x.ObjectSID = d.ObjectSID ) ) as x end declare @DBQueueElements_018 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct a.uid_person as uid9 from adsaccountinadsgroup aig join adsaccount a on aig.uid_adsaccount = a.uid_adsaccount and aig.XOrigin > 0 join deleted g on aig.uid_adsGroup = g.uid_adsGroup10 where a.uid_person > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-PersonHasObject', @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw 11insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct a.uid_person as uid from ADSContactInADSGroup12 aig join ADSContact a on aig.UID_ADSContact = a.uid_ADSContact and aig.XOrigin > 0 join deleted g on aig.uid_adsGroup = g.uid_adsGroup where a.uid_person13 > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-PersonHasObject', @DBQueueElements_02 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR14 ('', 18, 1) WITH NOWAIT END CATCH ende: return end 15