dbo.QBM_PDatabaseTriggerDrop
SQL_STORED_PROCEDURE
Created 2026-04-14T23:14:10.663 · modified 2026-04-14T23:14:10.663 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@TriggerPattern | nvarchar | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| DialogDatabase | OBJECT_OR_COLUMN | ||
| QBM_PExecuteSQLWithRetry_LLP | OBJECT_OR_COLUMN | ||
| QBM_PJournal | OBJECT_OR_COLUMN | ||
| QBM_PSessionErrorAdd | OBJECT_OR_COLUMN | ||
| dbo | QBM_FCVIntToString | OBJECT_OR_COLUMN | |
| dbo | QBM_FGISessionErrorRethrow | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1create procedure QBM_PDatabaseTriggerDrop (@TriggerPattern nvarchar(64) = '%' ) as begin declare @musterTrigger nvarchar(1024) declare @SQLcmd 2 nvarchar(max) declare @Triggername nvarchar(64) declare @elements table (ElementIndex int identity NOT NULL , LongIdent1 nvarchar(256) collate database_default 3 ) declare @ElementCount int declare @ElementIndex int declare @JournalMessage nvarchar(1000) declare @DebugSwitch int = 0 declare @DebugLevel varchar(1 4) = 'I' declare @MessageType varchar(1) = 'W' SET XACT_ABORT OFF BEGIN TRY select @musterTrigger = N'drop trigger if exists "%triggername%" on database ' 5 insert into @elements(LongIdent1) select t.name as Triggername from sys.triggers t where parent_class = 0 and is_ms_shipped = 0 and t.name like @TriggerPattern 6 order by 1 select @ElementCount = count(*) from @elements select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @TriggerName 7 = bu.LongIdent1 from @elements bu where bu.ElementIndex = @ElementIndex select @SQLcmd = replace(@musterTrigger, '%triggername%', @Triggername) if @DebugSwitch 8 > 0 begin print @SQLcmd end exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLcmd , @LockTimeout_ms = 2500 , @MaxWaitTimeForLock_s = 10 , @ProcIDForJournal 9 = @@procid , @HandleErrorSilent = 0 , @ExecuteWithTransact = 0 select @ElementIndex += 1 end if @ElementCount > 0 and exists (select top 1 1 from sys.objects 10 o where o.name = 'QBM_PJournal' and type = 'P' ) begin select @JournalMessage = '#LDS#System elements modified by {0}, pattern {1}, elements affected {2}.|' 11 + isnull(OBJECT_NAME(@@procid), '') + '|' + @TriggerPattern + '|' + dbo.QBM_FCVIntToString(@ElementCount) + '|' if not exists (select top 1 1 from DialogDatabase 12 where IsMainDatabase = 1 and UpdatePhase <> 0) and not exists (select top 1 1 from sys.tables t with (readpast) join sys.columns c with (readpast) on 13t.object_id = c.object_id where t.name = 'DialogDatabase' and c.name = 'InitialMigrationRunning' ) begin exec QBM_PJournal @JournalMessage, @@procid, @MessageType 14, @DebugLevel end else begin exec QBM_PJournal @JournalMessage, @@procid, 'I', 'I' end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare 15 @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: return end 16
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.663
has TRY/CATCH error handling
Summary: calls QBM_PExecuteSQLWithRetry_LLP, QBM_PJournal, QBM_PSessionErrorAdd; writes INSERT into; reads/joins sys, DialogDatabase
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@TriggerPattern | nvarchar(64) | input |
DML targets
INSERT intoCalled routines
Read/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: None extracted.
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: #LDS #System
Variables: @TriggerPattern @musterTrigger @SQLcmd @Triggername @elements @ElementCount @ElementIndex @JournalMessage @DebugSwitch @DebugLevel @MessageType @TriggerName @SQLStatement @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @procid @HandleErrorSilent @ExecuteWithTransact @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.
No reverse dependencies extracted.