Back to OIM Explorer

dbo.QBM_TUDialogUser

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on DialogUser. Bulk DBQueue insert -> QBM-K-DialogUserInGroup / QBM_ZDialogUserInGroup at line 9; References QBM_PDBQueueInsert_Bulk; Trigger parent table: DialogUser

Source: sandbox-db sys.sql_modules

Source size: 1.619 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-DialogUserInGroup / QBM_ZDialogUserInGroup at line 9
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: DialogUser

Typed Edges

  • queues DBQueue task QBM_ZDialogUserInGroup at line 9 Bulk DBQueue insert -> QBM-K-DialogUserInGroup / QBM_ZDialogUserInGroup at line 9
  • trigger on table DialogUser Trigger parent table: DialogUser
  • 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

SQL86 lines
1CREATE trigger QBM_TUDialogUser2  ON DialogUser FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @ProcName nvarchar(64) = object_name(@@procid)7  DECLARE @DebugSwitch int = 08  BEGIN TRY9    IF EXISTS(10      SELECT TOP 1 111      FROM inserted)12    GOTO start13    IF EXISTS(14      SELECT TOP 1 115      FROM deleted)16    GOTO start17    RETURN start:18    DECLARE @GenProcID varchar(38)19    SELECT @GenProcID = dbo.QBM_FGISessionContext('')20    IF @Debugswitch > 021    BEGIN22      print 'entry : ' + @ProcName23    END24    IF25    UPDATE(UserName)26    BEGIN27      IF EXISTS(28        SELECT TOP 1 129        FROM dialogUser u30        JOIN deleted d31          ON u.UID_DialogUser = d.UID_DialogUser32        WHERE33          isnull(u.UserName, N '') <> isnull(d.Username, N '') AND d.Username > ' ')34      BEGIN35        RAISERROR('#LDS#Cannot rename property Username.|',36        18,37        2)38          WITH nowait39      END40    END41    IF42    UPDATE(IsAdmin)43    BEGIN44      DELETE DialogUserInGroup45      FROM DialogUserInGroup uig46      JOIN deleted d47        ON d.UID_DialogUser = uig.UID_DialogUser48      JOIN DialogUser u49        ON d.UID_DialogUser = u.UID_DialogUser AND d.IsAdmin = 1 AND u.IsAdmin = 050    END51    IF52    UPDATE(IsServiceAccount) OR53    UPDATE(IsAdmin)54    BEGIN55      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw56      INSERT INTO @DBQueueElements_01(Object,57      SubObject,58      GenProcID)59      SELECT60        x.uid,61        NULL,62        @GenProcID63      FROM(64      SELECT65        DISTINCT u.UID_DialogUser AS uid66      FROM deleted d67      JOIN DialogUser u68        ON d.UID_DialogUser = u.UID_DialogUser69      WHERE70        d.IsAdmin <> u.IsAdmin OR d.IsServiceAccount <> u.IsServiceAccount) AS x71      EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-DialogUserInGroup',72        @DBQueueElements_0173    END74  END TRY75  BEGIN CATCH76    EXEC QBM_PSessionErrorAdd DEFAULT77    RAISERROR('',78    18,79    1)80      WITH NOWAIT81  END CATCH82  IF @Debugswitch > 083  BEGIN84    print 'exit : ' + @ProcName85  END86END
Open raw exported source
SQL ยท Raw12 lines
1  create   trigger QBM_TUDialogUser on DialogUser  for Update not for Replication as begin  declare @ProcName nvarchar(64) = object_name(@@procid2) declare @DebugSwitch int = 0 BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return 3start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if @Debugswitch > 0 begin print 'entry : ' + @ProcName end if update4(UserName) begin if exists (select top 1 1 from dialogUser u join deleted d on u.UID_DialogUser = d.UID_DialogUser where isnull(u.UserName, N'') <> isnull5(d.Username, N'') and d.Username > ' '  ) begin raiserror( '#LDS#Cannot rename property Username.|', 18, 2) with nowait end end if update(IsAdmin) begin6  delete DialogUserInGroup from DialogUserInGroup uig join deleted d on d.UID_DialogUser = uig.UID_DialogUser join DialogUser u on d.UID_DialogUser = u.UID_DialogUser7 and d.IsAdmin = 1 and u.IsAdmin = 0  end if update(IsServiceAccount) or update(IsAdmin) begin   declare @DBQueueElements_01 QBM_YDBQueueRaw insert into8 @DBQueueElements_01(Object, SubObject, GenProcID) select x.uid, null, @GenProcID from ( select distinct u.UID_DialogUser as uid from deleted d join DialogUser9 u on d.UID_DialogUser = u.UID_DialogUser where d.IsAdmin <> u.IsAdmin or d.IsServiceAccount <> u.IsServiceAccount ) as x exec QBM_PDBQueueInsert_Bulk 10'QBM-K-DialogUserInGroup', @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH if11 @Debugswitch > 0 begin print 'exit : ' + @ProcName end end 12