Back to OIM Explorer

dbo.QBM_TUDialogTable

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on DialogTable. Bulk DBQueue insert -> QBM-K-CommonPrepropTable / QBM_ZPrePropTable at line 23; Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 23; Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 23; Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 23

Source: sandbox-db sys.sql_modules

Source size: 6.069 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 23
  • Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 23
  • Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 23
  • Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 23
  • Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 27
  • Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 27
  • Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 27
  • Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 37
  • Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 37
  • Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 44
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: DialogTable

Typed Edges

  • queues DBQueue task QBM_ZPrePropTable at line 23 Bulk DBQueue insert -> QBM-K-CommonPrepropTable / QBM_ZPrePropTable at line 23
  • queues DBQueue task QBM_ZTriggerWatchCreate at line 23 Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 23
  • queues DBQueue task QBM_ZMissingDisplayRightFill at line 23 Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 23
  • queues DBQueue task QBM_ZTriggerWatchCreate at line 27 Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 27
  • queues DBQueue task QBM_ZMissingDisplayRightFill at line 27 Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 27
  • queues DBQueue task QBM_ZMissingDisplayRightFill at line 37 Bulk DBQueue insert -> QBM-K-MissingDisplayRightFill / QBM_ZMissingDisplayRightFill at line 37
  • queues DBQueue task QBM_ZTriggerWatchCreate at line 37 Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 37
  • queues DBQueue task QBM_ZTriggerWatchCreate at line 44 Bulk DBQueue insert -> QBM-K-CommonMakeWatchtrigger / QBM_ZTriggerWatchCreate at line 44
  • trigger on table DialogTable Trigger parent table: DialogTable
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_FGITableName source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PGUIDReplaceCustomizerFill source text reference
  • references source dbo.QBM_PPrePropCheckSyntax source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PSQLCheckExecutable source text reference

Complete Source

SQL258 lines
1CREATE trigger QBM_TUDialogTable2  ON DialogTable FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @msg nvarchar(1000)7  DECLARE @SQLToCheck QBM_YParameterList8  DECLARE @ConditionsToCheck QBM_YParameterList9  BEGIN TRY10    IF EXISTS(11      SELECT TOP 1 112      FROM inserted)13    GOTO start14    IF EXISTS(15      SELECT TOP 1 116      FROM deleted)17    GOTO start18    RETURN start:19    DECLARE @GenProcID varchar(38)20    SELECT @GenProcID = dbo.QBM_FGISessionContext('')21    IF22    UPDATE(UID_QBMDiskStoreLogical)23    BEGIN24      IF EXISTS(25        SELECT TOP 1 126        FROM deleted d27        JOIN DialogTable t28          ON d.UID_DialogTable = t.UID_DialogTable29        WHERE30          t.TableName IN(31        SELECT TableName32        FROM QBM_VStartupTables33        UNION34        SELECT 'QBMDiskStoreLogical'35        UNION36        SELECT37          'QBMDiskStorePhysical') AND d.UID_QBMDiskStoreLogical IS NULL AND t.UID_QBMDiskStoreLogical > ' ')38      BEGIN39        SELECT @msg = '#LDS#Cannot move the selected Table(s) to other filegroup.|'40        RAISERROR(@msg,41        18,42        1)43          WITH nowait44      END45    END46    IF47    UPDATE(UID_DialogTable) OR48    UPDATE(TableName)49    BEGIN50      IF EXISTS(51        SELECT TOP 1 152        FROM inserted i53        WHERE54          i.UID_DialogTable NOT LIKE '___-T-' + i.TableName)55      BEGIN56        RAISERROR('#LDS#TableName and UID_DialogTable mismatch|',57        18,58        1)59          WITH nowait60      END61    END62    IF63    UPDATE(ViewWhereClause)64    BEGIN65      DELETE @SQLToCheck66      INSERT INTO @SQLToCheck(Parameter1,67      ContentFull)68      SELECT69        c.XObjectKey,70        'select top 1 1 as columnvalue from ' + b.TableName + '71		 where (72		 ' + c.ViewWhereClause + '73		 )'74      FROM inserted c75      JOIN DialogTable b76        ON b.UID_DialogTable = c.UID_DialogTableBase77      WHERE78        c.ViewWhereClause > ' '79      EXEC QBM_PSQLCheckExecutable @SQLToCheck,80        @RaiseError = 181    END82    IF83    UPDATE(ExtensionForProxyTable)84    BEGIN85      DELETE @SQLToCheck86      INSERT INTO @SQLToCheck(Parameter1,87      ContentFull)88      SELECT89        i.XObjectKey,90        CONCAT('select top 1 1 as columnvalue 91									from (',92        ' select ',93        i.ExtensionForProxyTable,94        '95											from ',96        i.tablename,97        '98											where 1 = 099										) as x')100      FROM inserted i101      WHERE102        i.ExtensionForProxyTable > ' '103      EXEC QBM_PSQLCheckExecutable @SQLToCheck,104        @RaiseError = 1105    END106    IF107    UPDATE(preprocessorcondition)108    BEGIN109      INSERT INTO @ConditionsToCheck(ContentFull)110      SELECT i.PreProcessorCondition111      FROM inserted i112      EXEC QBM_PPrePropCheckSyntax @ConditionsToCheck113      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw114      INSERT INTO @DBQueueElements_01(object,115      subobject,116      genprocid)117      SELECT118        dbo.QBM_FGITableName(x.uid),119        NULL,120        @GenProcID121      FROM(122      SELECT i.UID_DialogTable AS UID123      FROM DialogTable i124      JOIN deleted d125        ON i.UID_DialogTable = d.UID_DialogTable AND isnull(i.preprocessorcondition, N '') <> isnull(d.preprocessorcondition,126      N '')) AS x127      EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-CommonPrepropTable',128        @DBQueueElements_01129    END130    IF131    UPDATE(IsModuleGUIDAllowed)132    BEGIN133      EXEC QBM_PGUIDReplaceCustomizerFill134    END135    IF136    UPDATE(IsMAllTable) OR137    UPDATE(IsMNTable)138    BEGIN139      DECLARE @DBQueueElements_02 QBM_YDBQueueRaw140      INSERT INTO @DBQueueElements_02(object,141      subobject,142      genprocid)143      SELECT144        x.uid,145        NULL,146        @GenProcID147      FROM(148      SELECT i.Tablename AS UID149      FROM DialogTable i150      JOIN deleted d151        ON i.UID_DialogTable = d.UID_DialogTable152      WHERE153        isnull(i.IsMAllTable, 0) <> isnull(d.IsMAllTable, 0) OR isnull(i.IsMNTable, 0) <> isnull(d.IsMNTable,154      0)) AS x155      EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-CommonMakeWatchtrigger',156        @DBQueueElements_02157    END158    IF159    UPDATE(IsDeactivatedByPreProcessor) OR160    UPDATE(DisplayPattern) OR161    UPDATE(DisplayPatternLong)162    BEGIN163      DECLARE @DBQueueElements_36836 QBM_YDBQueueRaw164      INSERT INTO @DBQueueElements_36836(Object,165      SubObject,166      GenProcID)167      SELECT168        x.uid,169        NULL,170        @GenProcID171      FROM(172      SELECT ra.UID_DialogTableParent AS uid173      FROM deleted d174      JOIN DialogTable t175        ON d.UID_DialogTable = t.UID_DialogTable176      JOIN QBM_VQBMRelationALL ra177        ON t.UID_DialogTable = ra.UID_DialogTableChild178      WHERE179        isnull(d.IsDeactivatedByPreProcessor, 0) <> isnull(t.IsDeactivatedByPreProcessor, 0) OR isnull(d.DisplayPattern,180      '') <> isnull(t.DisplayPattern, '') OR isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong,181      '')182      UNION183      SELECT ra.UID_DialogTableChild184      FROM deleted d185      JOIN DialogTable t186        ON d.UID_DialogTable = t.UID_DialogTable187      JOIN QBM_VQBMRelationALL ra188        ON t.UID_DialogTable = ra.UID_DialogTableParent189      WHERE190        isnull(d.IsDeactivatedByPreProcessor, 0) <> isnull(t.IsDeactivatedByPreProcessor, 0) OR isnull(d.DisplayPattern,191      '') <> isnull(t.DisplayPattern, '') OR isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong,192      '')193      UNION194      SELECT t.UID_DialogTable195      FROM deleted d196      JOIN DialogTable t197        ON d.UID_DialogTable = t.UID_DialogTable198      WHERE199        isnull(d.IsDeactivatedByPreProcessor, 0) <> isnull(t.IsDeactivatedByPreProcessor, 0) OR isnull(d.DisplayPattern,200      '') <> isnull(t.DisplayPattern, '') OR isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong,201      '')) AS x202      EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-MissingDisplayRightFill',203        @DBQueueElements_36836204    END205    IF206    UPDATE(DisplayPattern) OR207    UPDATE(DisplayPatternLong)208    BEGIN209      DECLARE @DBQueueElements_478791 QBM_YDBQueueRaw210      INSERT INTO @DBQueueElements_478791(Object,211      SubObject,212      GenProcID)213      SELECT214        x.uid,215        NULL,216        @GenProcID217      FROM(218      SELECT d.TableName AS uid219      FROM deleted d220      JOIN DialogTable t221        ON d.UID_DialogTable = t.UID_DialogTable222      WHERE223        isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') OR isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong,224      '')225      UNION226      SELECT r.ChildTable227      FROM QBM_VQBMRelation r228      JOIN deleted d229        ON r.ParentTable = d.TableName230      JOIN DialogTable t231        ON d.UID_DialogTable = t.UID_DialogTable232      WHERE233        isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') OR isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong,234      '')235      UNION236      SELECT r2.ChildTable237      FROM QBM_VQBMRelation r1238      JOIN QBM_VQBMRelation r2239        ON r1.ChildTable = r2.ParentTable240      JOIN deleted d241        ON r1.ParentTable = d.TableName242      JOIN DialogTable t243        ON d.UID_DialogTable = t.UID_DialogTable244      WHERE245        isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') OR isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong,246      '')) AS x247      EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-CommonMakeWatchtrigger',248        @DBQueueElements_478791249    END250  END TRY251  BEGIN CATCH252    EXEC QBM_PSessionErrorAdd DEFAULT253    RAISERROR('',254    18,255    1)256      WITH NOWAIT257  END CATCH258END
Open raw exported source
SQL ยท Raw46 lines
1  create   trigger QBM_TUDialogTable on DialogTable  for Update not for Replication as begin declare @msg nvarchar(1000) declare @SQLToCheck QBM_YParameterList2 declare @ConditionsToCheck QBM_YParameterList BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto3 start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if update(UID_QBMDiskStoreLogical) begin if exists4 (select top 1 1 from deleted d join DialogTable t on d.UID_DialogTable = t.UID_DialogTable where t.TableName in (select TableName from QBM_VStartupTables5 union select 'QBMDiskStoreLogical' union select 'QBMDiskStorePhysical' ) and d.UID_QBMDiskStoreLogical is null and t.UID_QBMDiskStoreLogical > ' ' ) begin6  select @msg = '#LDS#Cannot move the selected Table(s) to other filegroup.|' raiserror (@msg, 18, 1) with nowait end end if update(UID_DialogTable) or7 update(TableName) begin if exists (select top 1 1 from inserted i where i.UID_DialogTable not like '___-T-' + i.TableName ) begin raiserror ('#LDS#TableName and UID_DialogTable mismatch|'8, 18, 1) with nowait end end  if update(ViewWhereClause) begin delete  @SQLToCheck  insert into @SQLToCheck(Parameter1, ContentFull) select c.XObjectKey9, 'select top 1 1 as columnvalue from ' + b.TableName + '10		 where (11		 ' + c.ViewWhereClause + '12		 )' from inserted c  join DialogTable b on b.UID_DialogTable13 = c.UID_DialogTableBase where c.ViewWhereClause > ' ' exec QBM_PSQLCheckExecutable @SQLToCheck, @RaiseError = 1 end  if update(ExtensionForProxyTable)14 begin delete  @SQLToCheck insert into @SQLToCheck(Parameter1, ContentFull) select i.XObjectKey, concat('select top 1 1 as columnvalue 15									from ('16 , ' select ', i.ExtensionForProxyTable, '17											from ' , i.tablename , '18											where 1 = 019										) as x' ) from inserted i  where i.ExtensionForProxyTable20 > ' ' exec QBM_PSQLCheckExecutable @SQLToCheck, @RaiseError = 1 end if update(preprocessorcondition) begin  insert into @ConditionsToCheck (ContentFull21) select i.PreProcessorCondition from inserted i exec QBM_PPrePropCheckSyntax @ConditionsToCheck  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into22 @DBQueueElements_01 (object, subobject, genprocid) select dbo.QBM_FGITableName(x.uid), null, @GenProcID from (select i.UID_DialogTable as UID from DialogTable23 i join deleted d on i.UID_DialogTable = d.UID_DialogTable and isnull(i.preprocessorcondition,N'') <> isnull(d.preprocessorcondition,N'') ) as x exec QBM_PDBQueueInsert_Bulk24 'QBM-K-CommonPrepropTable', @DBQueueElements_01 end if update(IsModuleGUIDAllowed) begin exec QBM_PGUIDReplaceCustomizerFill end  if update(IsMAllTable25) or update(IsMNTable) begin declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null26, @GenProcID from (select i.Tablename as UID from DialogTable i join deleted d on i.UID_DialogTable = d.UID_DialogTable where isnull(i.IsMAllTable, 0) 27<> isnull(d.IsMAllTable, 0) or isnull(i.IsMNTable, 0) <> isnull(d.IsMNTable, 0) ) as x exec QBM_PDBQueueInsert_Bulk 'QBM-K-CommonMakeWatchtrigger', @DBQueueElements_0228 end     if update (IsDeactivatedByPreProcessor) or update (DisplayPattern) or update(DisplayPatternLong) begin declare @DBQueueElements_36836 QBM_YDBQueueRaw29 insert into @DBQueueElements_36836(Object, SubObject, GenProcID) select x.uid, null, @GenProcID from ( select ra.UID_DialogTableParent as uid from deleted30 d join DialogTable t on d.UID_DialogTable = t.UID_DialogTable join QBM_VQBMRelationALL ra on t.UID_DialogTable = ra.UID_DialogTableChild where isnull(d.IsDeactivatedByPreProcessor31, 0) <> isnull(t.IsDeactivatedByPreProcessor, 0) or isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') or isnull(d.DisplayPatternLong, '') <>32 isnull(t.DisplayPatternLong, '') union select ra.UID_DialogTableChild from deleted d join DialogTable t on d.UID_DialogTable = t.UID_DialogTable join 33QBM_VQBMRelationALL ra on t.UID_DialogTable = ra.UID_DialogTableParent where isnull(d.IsDeactivatedByPreProcessor, 0) <> isnull(t.IsDeactivatedByPreProcessor34, 0) or isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') or isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong, '') union select35 t.UID_DialogTable from deleted d join DialogTable t on d.UID_DialogTable = t.UID_DialogTable where isnull(d.IsDeactivatedByPreProcessor, 0) <> isnull(t.IsDeactivatedByPreProcessor36, 0) or isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') or isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong, '') ) as x exec37 QBM_PDBQueueInsert_Bulk 'QBM-K-MissingDisplayRightFill', @DBQueueElements_36836 end  if update (DisplayPattern) or update(DisplayPatternLong) begin declare38 @DBQueueElements_478791 QBM_YDBQueueRaw insert into @DBQueueElements_478791(Object, SubObject, GenProcID) select x.uid, null, @GenProcID from ( select39 d.TableName as uid from deleted d join DialogTable t on d.UID_DialogTable = t.UID_DialogTable where isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern40, '') or isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong, '') union select r.ChildTable from QBM_VQBMRelation r join deleted d on r.ParentTable41 = d.TableName join DialogTable t on d.UID_DialogTable = t.UID_DialogTable where isnull(d.DisplayPattern, '') <> isnull(t.DisplayPattern, '') or isnull42(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong, '') union select r2.ChildTable from QBM_VQBMRelation r1 join QBM_VQBMRelation r2 on r1.ChildTable43 = r2.ParentTable join deleted d on r1.ParentTable = d.TableName join DialogTable t on d.UID_DialogTable = t.UID_DialogTable where isnull(d.DisplayPattern44, '') <> isnull(t.DisplayPattern, '') or isnull(d.DisplayPatternLong, '') <> isnull(t.DisplayPatternLong, '') ) as x exec QBM_PDBQueueInsert_Bulk 'QBM-K-CommonMakeWatchtrigger'45, @DBQueueElements_478791 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 46