dbo.QBM_PTriggerEnable

SQL_STORED_PROCEDURE

Created 2025-06-27T17:57:00.523 · modified 2026-04-14T23:14:10.100 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
@TablePatternnvarcharno
@TriggerPatternnvarcharno
@UseTriggerPatternForNotLikebitno
@HandleErrorSilentbitno
@forcebitno

Referenced objects

SchemaObjectColumn/minorClass
DialogDatabaseOBJECT_OR_COLUMN
QBM_PExecuteSQLWithRetry_LLPOBJECT_OR_COLUMN
QBM_PIndicatorChangeOBJECT_OR_COLUMN
QBM_PJournalOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_PSessionErrorCleanOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
QBM_YSessionErrorTYPE
dboQBM_FCVIntToStringOBJECT_OR_COLUMN
dboQBM_FGISessionErrorRethrowOBJECT_OR_COLUMN

Source excerpt

First extracted SQL definition lines from the exported source. Use the full source page for complete context.

Open full formatted source

1   create   procedure QBM_PTriggerEnable (@TablePattern nvarchar(64)= '%' ,@TriggerPattern nvarchar(64) = '%' ,@UseTriggerPatternForNotLike bit 
2= 0 ,@HandleErrorSilent bit = 0   , @force bit = 0  ) as begin declare @musterTrigger nvarchar(1024) declare @SQLcmd nvarchar(max) declare @TabAktuell 
3varchar(30) declare @TableType varchar(16) declare @Triggername nvarchar(64)     declare @elements QBM_YCursorBuffer declare @ElementCount int declare 
4@ElementIndex int declare @JournalMessage nvarchar(1000) declare @DebugSwitch int = 0 declare @DebugLevel varchar(1) = 'I' declare @MessageType varchar
5(1) = 'I' declare @WarFehlerhaft int = 0 declare @CountElementsChanged int = 0 declare @ErrorBuffer QBM_YSessionError SET XACT_ABORT OFF BEGIN TRY set 
6nocount on if exists (select top 1 1 from DialogDatabase d where d.UpdatePhase not in ( 0) ) and @force = 0 begin goto endLabel end select @musterTrigger
7 = N'alter %type% "%table%" enable trigger %triggername% ' insert into @elements(LongIdent1, Ident2, LongIdent2) select distinct o.name , case o.type when
8 'U' then 'Table'  else '' end as TableType , case @TriggerPattern when '%' then 'all' else '"' + t.name + '"' end as Triggername from sys.tables o join
9 sys.triggers t on o.object_id = t.parent_id where t.name != 'QBM_TUIndicator474488' and o.type in( 'U' ) and o.is_memory_optimized = 0 and o.name like
10 @TablePattern and t.is_disabled = 1 and ( @UseTriggerPatternForNotLike = 0 and t.name like @TriggerPattern or @UseTriggerPatternForNotLike = 1 and t.name
11 not like @TriggerPattern ) order by 1 select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount  and @WarFehlerhaft
12 = 0 begin select top 1 @TabAktuell = bu.LongIdent1 , @TableType = bu.Ident2 , @TriggerName = bu.LongIdent2 from @elements bu where bu.ElementIndex = @ElementIndex
13 select @SQLcmd = replace(replace(replace(@musterTrigger , '%table%', @TabAktuell) , '%type%', @TableType) , '%triggername%', @Triggername) if @DebugSwitch
14 > 0 begin print @SQLcmd end  BEGIN TRY  exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLcmd , @LockTimeout_ms = 2500  , @MaxWaitTimeForLock_s = 
1510  , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0  , @ExecuteWithTransact = 0 select @CountElementsChanged += 1 exec QBM_PSessionErrorClean END
16 TRY BEGIN CATCH if @HandleErrorSilent = 0 begin delete @ErrorBuffer insert into @ErrorBuffer (ErrorMessage, ErrorSeverity, ErrorState, ErrorNumber , ProcedureName
17, ProcedureLine, MessageDate , GenProcID, RepeatCounter, IsReThrow, SourceCode) select concat('#LDS#Possible invalid foreign keys, run consistency checks: {0}|'
18 , ERROR_MESSAGE() , '|' ), 18, 1, 50000 , object_name(@@PROCID), ERROR_LINE(), GETUTCDATE() , null, 0, 0, @SQLcmd exec QBM_PSessionErrorAdd @ErrorBuffer
19 exec QBM_PJournal 'SessionError', @@procid, 'E', @DebugLevel, 20 exec QBM_PSessionErrorClean end  select @WarFehlerhaft = 1 END CATCH select @ElementIndex
20 += 1 end  if @CountElementsChanged > 0 and exists (select top 1 1 from sys.objects o where o.name = 'QBM_PJournal' and type = 'P' ) begin select @JournalMessage
21 = '#LDS#System elements modified by {0}, pattern {1}, elements affected {2}.|' + isnull(OBJECT_NAME(@@procid), '') + '|' + @TablePattern + '|' + dbo.QBM_FCVIntToString
22(@CountElementsChanged) + '|'  if not exists (select top 1 1 from DialogDatabase where IsMainDatabase = 1 and UpdatePhase <> 0) and not exists (select 
23top 1 1 from sys.tables t with (readpast) join sys.columns c with (readpast) on t.object_id = c.object_id where t.name = 'DialogDatabase' and c.name = 
24'InitialMigrationRunning' ) begin exec QBM_PJournal @JournalMessage, @@procid, @MessageType, @DebugLevel, 20 end else begin  exec QBM_PJournal @JournalMessage
25, @@procid, 'I', 'I' end end exec QBM_PIndicatorChange 1 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow
26() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel:  return (@WarFehlerhaft) end 
27

Module relation graph

Loading module relation graph…

Source-derived context

Generated from exported SQL module definitions plus read-only sandbox sys.objects/sys.parameters/sys.sql_expression_dependencies metadata. This is factual source evidence, not a semantic guess.

provenance: SQL definition export provenance: sandbox DB metadata modified: 2026-04-14T23:14:10.100

has TRY/CATCH error handling

Summary: calls QBM_PExecuteSQLWithRetry_LLP, QBM_PSessionErrorClean, QBM_PSessionErrorAdd, QBM_PJournal, QBM_PIndicatorChange; writes INSERT into; reads/joins DialogDatabase, sys

Declared parameters

ParameterTypeDirection
@TablePatternnvarchar(64)input
@TriggerPatternnvarchar(64)input
@UseTriggerPatternForNotLikebitinput
@HandleErrorSilentbitinput
@forcebitinput

DML targets

INSERT into

Read/join references

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: #LDS #Possible #System

Variables: @TablePattern @TriggerPattern @UseTriggerPatternForNotLike @HandleErrorSilent @force @musterTrigger @SQLcmd @TabAktuell @TableType @Triggername @elements @ElementCount @ElementIndex @JournalMessage @DebugSwitch @DebugLevel @MessageType @WarFehlerhaft @CountElementsChanged @ErrorBuffer @ROWCOUNT @TriggerName @SQLStatement @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @procid @ExecuteWithTransact @PROCID @Rethrow

Referenced by / reverse dependencies

Generated from live DB metadata, FK rows, and exported SQL dependency/source extraction. This is factual linkage evidence, not inferred behavior.

Referencing objectRelationEvidence
dbo.QBM_PDeleteDeepSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PDeleteDeep_LSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_ZConstraintEnableSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PDeleteDeepsource text referencehas TRY/CATCH error handling
dbo.QBM_PDeleteDeep_Lsource text referenceinserts DBQueue tasks, has TRY/CATCH error handling
dbo.QBM_ZConstraintEnablesource text referenceinserts DBQueue tasks, has TRY/CATCH error handling