Back to OIM Explorer

dbo.ADS_TDADSAccount

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on ADSAccount. Bulk DBQueue insert -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 11; References QBM_PDBQueueInsert_Bulk; Trigger parent table: ADSAccount

Source: sandbox-db sys.sql_modules

Source size: 1.831 characters

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 11
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: ADSAccount

Typed Edges

  • queues DBQueue task ADS_ZPersonHasObject at line 11 Bulk DBQueue insert -> ADS-K-PersonHasObject / ADS_ZPersonHasObject at line 11
  • trigger on table ADSAccount Trigger parent table: ADSAccount
  • 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

SQL101 lines
1CREATE trigger ADS_TDADSAccount2  ON ADSAccount FOR3DELETE NOT FOR Replication4AS5BEGIN6  IF EXISTS(7    SELECT TOP 1 18    FROM deleted)9  GOTO start10  RETURN start:11  DECLARE @GenProcID varchar(38)12  BEGIN TRY13    SELECT @GenProcID = dbo.QBM_FGISessionContext('')14    IF EXISTS(15      SELECT TOP 1 116      FROM deleted d17      JOIN PersonHasTSBAccountDef pha18        ON d.UID_Person = pha.UID_Person AND d.UID_TSBAccountDef = pha.UID_TSBAccountDef19      WHERE20        pha.XOrigin > 0 AND pha.XIsInEffect = 1)21    BEGIN22      RAISERROR('#LDS#Delete Accounts with existing PersonHasTSBAccountDef is not permitted.|',23      18,24      1)25        WITH nowait26    END27    IF EXISTS(28      SELECT TOP 1 129      FROM deleted d30      WHERE31        d.ObjectSID > ' ')32    BEGIN33      INSERT INTO ADSOtherSID(UID_ADSOtherSID,34      ObjectSID,35      DistinguishedName,36      canonicalName,37      Ident_ADSOtherSID,38      XDateInserted,39      XDateUpdated,40      XUserInserted,41      XUserUpdated,42      XObjectKey)43      SELECT44        x.UID_ADSOtherSID,45        x.ObjectSID,46        x.DistinguishedName,47        x.canonicalName,48        x.Ident_ADSOtherSID,49        x.XDateInserted,50        x.XDateUpdated,51        x.XUserInserted,52        x.XUserUpdated,53        dbo.QBM_FCVElementToObjectKey1('ADSOtherSID',54        'UID_ADSOtherSID',55        x.UID_ADSOtherSID)56      FROM(57      SELECT58        newid() AS UID_ADSOtherSID,59        d.ObjectSID,60        d.DistinguishedName,61        d.canonicalName,62        d.cn AS Ident_ADSOtherSID,63        d.XDateInserted,64        d.XDateUpdated,65        d.XUserInserted,66        d.XUserUpdated67      FROM deleted d68      WHERE69        d.ObjectSID > ' ' AND NOT EXISTS(70      SELECT TOP 1 171      FROM ADSOtherSID x72      WHERE73        x.ObjectSID = d.ObjectSID)) AS x74    END75    DECLARE @DBQueueElements_01 QBM_YDBQueueRaw76    INSERT INTO @DBQueueElements_01(object,77    subobject,78    genprocid)79    SELECT80      x.uid,81      NULL,82      @GenProcID83    FROM(84    SELECT85      DISTINCT uid_person AS uid86    FROM deleted87    WHERE88      uid_person > ' ') AS x89    EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-PersonHasObject',90      @DBQueueElements_0191  END TRY92  BEGIN CATCH93    EXEC QBM_PSessionErrorAdd DEFAULT94    RAISERROR('',95    18,96    1)97      WITH NOWAIT98  END CATCH99  ende:100  RETURN101END
Open raw exported source
SQL ยท Raw13 lines
1create   trigger ADS_TDADSAccount on ADSAccount  for DELETE not for Replication as begin  if exists (select top 1 1 from deleted) goto start return2 start: declare @GenProcID varchar(38) BEGIN TRY select @GenProcID = dbo.QBM_FGISessionContext('')  if exists (select top 1 1 from deleted d join PersonHasTSBAccountDef3 pha on d.UID_Person = pha.UID_Person and d.UID_TSBAccountDef = pha.UID_TSBAccountDef where pha.XOrigin > 0 and pha.XIsInEffect = 1  ) begin raiserror(4'#LDS#Delete Accounts with existing PersonHasTSBAccountDef is not permitted.|', 18, 1) with nowait end   if exists (select top 1 1 from deleted d where5 d.ObjectSID > ' ' ) begin insert into ADSOtherSID (UID_ADSOtherSID, ObjectSID , DistinguishedName, canonicalName, Ident_ADSOtherSID , XDateInserted, XDateUpdated6, XUserInserted, XUserUpdated, XObjectKey) select x.UID_ADSOtherSID, x.ObjectSID , x.DistinguishedName, x.canonicalName, x.Ident_ADSOtherSID , x.XDateInserted7, x.XDateUpdated, x.XUserInserted, x.XUserUpdated, dbo.QBM_FCVElementToObjectKey1('ADSOtherSID', 'UID_ADSOtherSID', x.UID_ADSOtherSID) from ( select newid8() as UID_ADSOtherSID, d.ObjectSID , d.DistinguishedName, d.canonicalName, d.cn as Ident_ADSOtherSID , d.XDateInserted, d.XDateUpdated, d.XUserInserted9, d.XUserUpdated from deleted d where d.ObjectSID > ' ' and not exists (select top 1 1 from ADSOtherSID x where x.ObjectSID = d.ObjectSID ) ) as x end 10   declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select11 distinct uid_person as uid from deleted where uid_person > ' ' ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-PersonHasObject', @DBQueueElements_01 END TRY12 BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 13