Back to OIM Explorer

dbo.QER_TUHardware

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on Hardware. Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 16; Bulk DBQueue insert -> QER-K-HelperHardwareOrg / QER_ZHelperHardwareOrg at line 16; References QBM_PDBQueueInsert_Bulk; Trigger parent table: Hardware

Source: sandbox-db sys.sql_modules

Source size: 2.658 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 -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 16
  • Bulk DBQueue insert -> QER-K-HelperHardwareOrg / QER_ZHelperHardwareOrg at line 16
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: Hardware

Typed Edges

  • queues DBQueue task QER_ZAllForOneHardware at line 16 Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 16
  • queues DBQueue task QER_ZHelperHardwareOrg at line 16 Bulk DBQueue insert -> QER-K-HelperHardwareOrg / QER_ZHelperHardwareOrg at line 16
  • trigger on table Hardware Trigger parent table: Hardware
  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • references source dbo.QBM_FGIColumnUpdatedOthers 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

SQL107 lines
1CREATE trigger QER_TUHardware2  ON Hardware FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @XDateInserted datetime,7  @XDateUpdated datetime,8  @XUserInserted nvarchar(64),9  @XUserUpdated nvarchar(64)10  DECLARE @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',11  0)12  BEGIN TRY13    IF EXISTS(14      SELECT TOP 1 115      FROM inserted)16    GOTO start17    IF EXISTS(18      SELECT TOP 1 119      FROM deleted)20    GOTO start21    RETURN start:22    DECLARE @GenProcID varchar(38)23    SELECT @GenProcID = dbo.QBM_FGISessionContext('')24    IF25    UPDATE(uid_Hardwaretype)26    BEGIN27      IF EXISTS(28        SELECT TOP 1 129        FROM Hardware i30        JOIN deleted d31          ON i.uid_Hardware = d.uid_Hardware AND isnull(i.uid_Hardwaretype, '') <> isnull(d.uid_Hardwaretype, '')32      JOIN Hardwaretype p33        ON i.UID_Hardwaretype = p.UID_Hardwaretype AND p.isInactive = 1)34      BEGIN35        RAISERROR('#LDS#Assignment cannot take place, because the device type is disabled.|',36        18,37        2)38          WITH nowait39      END40    END41    IF dbo.QBM_FGIColumnUpdatedOthers('Hardware',42    'XTouched',43    columns_updated()) = 1 AND(dbo.QBM_FGIColumnUpdatedOthers('Hardware', 'XMarkedForDeletion', columns_updated()) = 1 OR EXISTS(44    SELECT TOP 1 145    FROM inserted i46    JOIN Hardware p47      ON i.uid_Hardware = p.uid_Hardware48    WHERE49      sign(i.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay) <> sign(p.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay)))50    BEGIN51      DECLARE @maxAnzahl int52      SELECT @maxAnzahl = 10053      IF 100 <(54        SELECT count(*)55      FROM inserted) +(56      SELECT count(*)57      FROM deleted)58      BEGIN59        SELECT TOP 1 @maxAnzahl =((Count(*)) /10 + 1)60        FROM Hardware61      END62      ELSE63      BEGIN64        SELECT @maxAnzahl = 107374182465      END66    END67    IF68    UPDATE(uid_department) OR69    UPDATE(uid_locality) OR70    UPDATE(uid_ProfitCenter) OR71    UPDATE(XMarkedForDeletion) OR72    UPDATE(IsNoInherite)73    BEGIN74      DECLARE @DBQueueElements_04 QBM_YDBQueueRaw75      INSERT INTO @DBQueueElements_04(object,76      subobject,77      genprocid)78      SELECT79        x.uid,80        NULL,81        @GenProcID82      FROM(83      SELECT84        DISTINCT h.uid_Hardware AS uid85      FROM deleted d86      JOIN Hardware h87        ON d.uid_Hardware = h.uid_Hardware88      WHERE89        isnull(d.uid_department, '') <> isnull(h.uid_department, '') OR isnull(d.uid_locality, '') <> isnull(h.uid_locality,90      '') OR isnull(d.uid_ProfitCenter, '') <> isnull(h.uid_ProfitCenter, '') OR isnull(d.IsNoInherite, 0) <> isnull(h.IsNoInherite,91      0) OR sign(d.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay) <> sign(h.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay)) AS x92      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneHardware',93        @DBQueueElements_0494      EXEC QBM_PDBQueueInsert_Bulk 'QER-K-HelperHardwareOrg',95        @DBQueueElements_0496    END97  END TRY98  BEGIN CATCH99    EXEC QBM_PSessionErrorAdd DEFAULT100    RAISERROR('',101    18,102    1)103      WITH NOWAIT104  END CATCH105  ende:106  RETURN107END
Open raw exported source
SQL ยท Raw18 lines
1create   trigger QER_TUHardware on Hardware  for Update not for Replication as begin declare @XDateInserted datetime , @XDateUpdated datetime , 2@XUserInserted nvarchar(64) , @XUserUpdated nvarchar(64) declare @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',3 0)  BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID 4varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('')   if update(uid_Hardwaretype) begin if exists(select top 1 1 from Hardware i join deleted5 d on i.uid_Hardware = d.uid_Hardware and isnull(i.uid_Hardwaretype,'') <> isnull(d.uid_Hardwaretype,'') join Hardwaretype p on i.UID_Hardwaretype = p.UID_Hardwaretype6 and p.isInactive = 1 ) begin  raiserror( '#LDS#Assignment cannot take place, because the device type is disabled.|', 18, 2) with nowait end end  if dbo.QBM_FGIColumnUpdatedOthers7 ('Hardware', 'XTouched', columns_updated()) = 1 and (dbo.QBM_FGIColumnUpdatedOthers ('Hardware', 'XMarkedForDeletion', columns_updated()) = 1 or exists8 ( select top 1 1 from inserted i join Hardware p on i.uid_Hardware = p.uid_Hardware  where  sign(i.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay9) <> sign(p.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay) ) ) begin   declare @maxAnzahl int select @maxAnzahl = 100 if 100 < (select count(*10) from inserted) + (select count(*) from deleted) begin select top 1 @maxAnzahl = ( (Count(*)) /10 + 1) from Hardware end else begin select @maxAnzahl 11= 1073741824  end end  if update(uid_department) or update(uid_locality) or update(uid_ProfitCenter) or update(XMarkedForDeletion) or update(IsNoInherite12) begin declare @DBQueueElements_04 QBM_YDBQueueRaw insert into @DBQueueElements_04 (object, subobject, genprocid) select x.uid, null, @GenProcID from 13( select distinct h.uid_Hardware as uid from deleted d join Hardware h on d.uid_Hardware = h.uid_Hardware where isnull(d.uid_department,'') <> isnull(h.uid_department14,'') or isnull(d.uid_locality,'') <> isnull(h.uid_locality,'') or isnull(d.uid_ProfitCenter,'') <> isnull(h.uid_ProfitCenter,'') or isnull(d.IsNoInherite15,0) <> isnull(h.IsNoInherite,0)  or  sign(d.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay) <> sign(h.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay16) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneHardware', @DBQueueElements_04 exec QBM_PDBQueueInsert_Bulk 'QER-K-HelperHardwareOrg', @DBQueueElements_0417 end   END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 18