Back to OIM Explorer

dbo.QBM_TUQBMRelation

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on QBMRelation. Bulk DBQueue insert -> QBM-K-CommonPrepropTable / QBM_ZPrePropTable at line 11; References QBM_PDBQueueInsert_Bulk; Trigger parent table: QBMRelation

Source: sandbox-db sys.sql_modules

Source size: 1.810 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 -> QBM-K-CommonPrepropTable / QBM_ZPrePropTable at line 11
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: QBMRelation

Typed Edges

  • queues DBQueue task QBM_ZPrePropTable at line 11 Bulk DBQueue insert -> QBM-K-CommonPrepropTable / QBM_ZPrePropTable at line 11
  • trigger on table QBMRelation Trigger parent table: QBMRelation
  • 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

Referenced By

  • No direct source references extracted.

Complete Source

SQL70 lines
1CREATE trigger QBM_TUQBMRelation2  ON QBMRelation FOR3UPDATE NOT FOR Replication4AS5BEGIN6  BEGIN TRY7    IF EXISTS(8      SELECT TOP 1 19      FROM inserted)10    GOTO start11    IF EXISTS(12      SELECT TOP 1 113      FROM deleted)14    GOTO start15    RETURN start:16    DECLARE @GenProcID varchar(38)17    SELECT @GenProcID = dbo.QBM_FGISessionContext('')18    IF19    UPDATE(ParentRestriction) OR20    UPDATE(ParentExecuteBy) OR21    UPDATE(ChildRestriction) OR22    UPDATE(ChildExecuteBy) OR23    UPDATE(IsForUpdateXDateSubItem)24    BEGIN25      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw26      INSERT INTO @DBQueueElements_01(object,27      subobject,28      genprocid)29      SELECT30        x.uid,31        NULL,32        @GenProcID33      FROM(34      SELECT t.TableName AS UID35      FROM deleted i36      JOIN QBMRelation r37        ON i.UID_QBMRelation = r.UID_QBMRelation38      JOIN DialogColumn c39        ON i.UID_ParentColumn = c.UID_DialogColumn40      JOIN DialogTable t41        ON c.UID_DialogTable = t.UID_DialogTable42      WHERE43        (r.ParentRestriction <> i.ParentRestriction OR r.ParentExecuteBy <> i.ParentExecuteBy OR r.ChildRestriction <> i.ChildRestriction OR r.ChildExecuteBy44      <> i.ChildExecuteBy OR r.IsForUpdateXDateSubItem <> i.IsForUpdateXDateSubItem) AND r.ParentExecuteBy IN('T',45      'D')46      UNION47      SELECT t.TableName AS UID48      FROM deleted i49      JOIN QBMRelation r50        ON i.UID_QBMRelation = r.UID_QBMRelation51      JOIN DialogColumn c52        ON i.UID_ChildColumn = c.UID_DialogColumn53      JOIN DialogTable t54        ON c.UID_DialogTable = t.UID_DialogTable55      WHERE56        (r.ParentRestriction <> i.ParentRestriction OR r.ParentExecuteBy <> i.ParentExecuteBy OR r.ChildRestriction <> i.ChildRestriction OR r.ChildExecuteBy57      <> i.ChildExecuteBy OR r.IsForUpdateXDateSubItem <> i.IsForUpdateXDateSubItem) AND r.ParentExecuteBy IN('T',58      'D')) AS x59      EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-CommonPrepropTable',60        @DBQueueElements_0161    END62  END TRY63  BEGIN CATCH64    EXEC QBM_PSessionErrorAdd DEFAULT65    RAISERROR('',66    18,67    1)68      WITH NOWAIT69  END CATCH70END
Open raw exported source
SQL ยท Raw13 lines
1  create   trigger QBM_TUQBMRelation on QBMRelation  for Update not for Replication as begin  BEGIN TRY if exists (select top 1 1 from inserted)2 goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext3('') if UPDATE(ParentRestriction) or UPDATE(ParentExecuteBy) or UPDATE(ChildRestriction) or UPDATE(ChildExecuteBy) or UPDATE(IsForUpdateXDateSubItem) begin4 declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select5 t.TableName as UID from deleted i join QBMRelation r on i.UID_QBMRelation = r.UID_QBMRelation join DialogColumn c on i.UID_ParentColumn = c.UID_DialogColumn6 join DialogTable t on c.UID_DialogTable = t.UID_DialogTable where (r.ParentRestriction <> i.ParentRestriction or r.ParentExecuteBy <> i.ParentExecuteBy7 or r.ChildRestriction <> i.ChildRestriction or r.ChildExecuteBy <> i.ChildExecuteBy or r.IsForUpdateXDateSubItem <> i.IsForUpdateXDateSubItem )  and r.ParentExecuteBy8 in ('T', 'D') union select t.TableName as UID from deleted i join QBMRelation r on i.UID_QBMRelation = r.UID_QBMRelation join DialogColumn c on i.UID_ChildColumn9 = c.UID_DialogColumn join DialogTable t on c.UID_DialogTable = t.UID_DialogTable where (r.ParentRestriction <> i.ParentRestriction or r.ParentExecuteBy10 <> i.ParentExecuteBy or r.ChildRestriction <> i.ChildRestriction or r.ChildExecuteBy <> i.ChildExecuteBy or r.IsForUpdateXDateSubItem <> i.IsForUpdateXDateSubItem11 )  and r.ParentExecuteBy in ('T', 'D') ) as x exec QBM_PDBQueueInsert_Bulk 'QBM-K-CommonPrepropTable', @DBQueueElements_01 end END TRY BEGIN CATCH exec12 QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 13