dbo.QBM_PTriggersInactiveForTable
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
Interpretation
- Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
- DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.
Relations
- Bulk DBQueue insert -> ) begin exec QBM_PDBQueueInsert_Bulk at line 10
- Bulk DBQueue insert -> QBM-K-TaskForInactiveTrigger / QBM_ZTaskForInactiveTrigger at line 10
- References QBM_PDBQueueInsert_Bulk
Typed Edges
- queues DBQueue task ) begin exec QBM_PDBQueueInsert_Bulk at line 10 Bulk DBQueue insert -> ) begin exec QBM_PDBQueueInsert_Bulk at line 10
- queues DBQueue task QBM_ZTaskForInactiveTrigger at line 10 Bulk DBQueue insert -> QBM-K-TaskForInactiveTrigger / QBM_ZTaskForInactiveTrigger at line 10
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_FGISessionErrorRethrow source text reference
- references source dbo.QBM_FGITableName source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_TUIndicator474488 source text reference
- queues DBQueue task QBM-K-TaskForInactiveTrigger -> QBM_ZTaskForInactiveTrigger QBM_PDBQueueInsert_Bulk 'QBM-K-TaskForInactiveTrigger', @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT…
Complete Source
1CREATE PROCEDURE QBM_PTriggersInactiveForTable(2 @TableName varchar(30),3 @EventName varchar(16)4)5AS6BEGIN7 DECLARE @GenProcID varchar(38)8 DECLARE @XUser nvarchar(64)9 DECLARE @DisabledValue BIT = 110 DECLARE @DebugSwitch int = 011 SET XACT_ABORT OFF12 BEGIN TRY13 SELECT @GenProcID = dbo.QBM_FGISessionContext('')14 SELECT @XUser = dbo.QBM_FGISessionContext('XUser')15 IF @DebugSwitch > 016 BEGIN17 print 'proc: QBM_PTriggersInactiveForTable, event ' + isnull(@EventName,18 '<none>')19 END20 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw21 INSERT INTO @DBQueueElements_01(Object,22 SubObject,23 GenProcID)24 SELECT25 DISTINCT26 LEFT(tr.name,27 30) AS Triggername,28 NULL,29 @GenProcID30 FROM DialogTable t31 WITH(readpast)32 JOIN sys.tables st33 ON st.name = CASE t.TableType34 WHEN 'V' THEN35 dbo.QBM_FGITableName(t.UID_DialogTableBase)36 WHEN 'M' THEN37 '#'38 ELSE t.TableName39 END AND t.TableName = @TableName40 JOIN sys.triggers tr41 ON tr.parent_id = st.object_id AND tr.is_disabled = @DisabledValue AND tr.name NOT LIKE 'GEN[_]%' AND tr.name != 'QBM_TUIndicator474488'42 JOIN sys.trigger_events ev43 ON ev.object_id = tr.object_id AND ev.type_desc = @EventName44 WHERE45 t.TableName NOT IN(46 SELECT s.TableName47 FROM QBM_VStartupTables s)48 IF @DebugSwitch > 049 BEGIN50 print 'detected triggernames'51 SELECT e.Object52 FROM @DBQueueElements_01 e53 END54 IF EXISTS(55 SELECT TOP 1 156 FROM @DBQueueElements_01) AND EXISTS(57 SELECT TOP 1 158 FROM sys.procedures p59 WHERE60 p.name = 'QBM_PDBQueueInsert_Bulk')61 BEGIN62 EXEC QBM_PDBQueueInsert_Bulk 'QBM-K-TaskForInactiveTrigger',63 @DBQueueElements_0164 END65 END TRY66 BEGIN CATCH67 EXEC QBM_PSessionErrorAdd DEFAULT68 DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()69 RAISERROR(@Rethrow,70 18,71 1)72 WITH NOWAIT73 END CATCH74END
Open raw exported source
1 create procedure QBM_PTriggersInactiveForTable ( @TableName varchar(30) , @EventName varchar(16) ) as begin declare @GenProcID varchar(38)2 declare @XUser nvarchar(64) declare @DisabledValue bit = 1 declare @DebugSwitch int = 0 SET XACT_ABORT OFF BEGIN TRY select @GenProcID = dbo.QBM_FGISessionContext3('') select @XUser = dbo.QBM_FGISessionContext('XUser') if @DebugSwitch > 0 begin print 'proc: QBM_PTriggersInactiveForTable, event ' + isnull(@EventName4, '<none>') end declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01(Object, SubObject, GenProcID) select distinct left(tr.name,5 30) as Triggername, null, @GenProcID from DialogTable t with (readpast) join sys.tables st on st.name = case t.TableType when 'V' then dbo.QBM_FGITableName6(t.UID_DialogTableBase) when 'M' then '#' else t.TableName end and t.TableName = @TableName join sys.triggers tr on tr.parent_id = st.object_id and tr.is_disabled7 = @DisabledValue and tr.name not like 'GEN[_]%' and tr.name != 'QBM_TUIndicator474488' join sys.trigger_events ev on ev.object_id = tr.object_id and 8ev.type_desc = @EventName where t.TableName not in (select s.TableName from QBM_VStartupTables s ) if @DebugSwitch > 0 begin print 'detected triggernames'9 select e.Object from @DBQueueElements_01 e end if exists (select top 1 1 from @DBQueueElements_01 ) and exists (select top 1 1 from sys.procedures p 10where p.name = 'QBM_PDBQueueInsert_Bulk' ) begin exec QBM_PDBQueueInsert_Bulk 'QBM-K-TaskForInactiveTrigger', @DBQueueElements_01 end END TRY BEGIN CATCH11 exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH 12end 13