dbo.QBM_PConstraintEnable

SQL_STORED_PROCEDURE

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

Open formatted source/search result

Parameters

NameTypeOutput
@TableNamenvarcharno
@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_YCursorBufferTYPE
QBM_YSessionErrorTYPE
dboQBM_FCVIntToStringOBJECT_OR_COLUMN
dboQBM_FGISessionErrorIsDeadlockOBJECT_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_PConstraintEnable (@TableName nvarchar(64)= N'%' ,@HandleErrorSilent bit = 0   , @force bit = 0  ) as begin declare @TabAktuell
2 nvarchar(64)     declare @elements QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int declare @JournalMessage nvarchar(1000) declare
3 @DebugLevel varchar(1) = 'I' declare @MessageType varchar(1) = 'I' declare @ErrorMessage nvarchar(4000) declare @ErrorSeverity int declare @ErrorState
4 int declare @WarFehlerhaft int = 0 declare @CountElementsChanged int = 0 declare @ErrorBuffer QBM_YSessionError declare @SQL nvarchar(max) SET XACT_ABORT
5 OFF BEGIN TRY if exists (select top 1 1 from DialogDatabase d where d.UpdatePhase not in ( 0) ) and @force = 0 begin goto endLabel end insert into @elements
6(Ident2) select distinct c.name as TableName  from sys.foreign_keys fk join sys.objects c on c.object_id = fk.parent_object_id join sys.objects p on p.object_id
7 = fk.referenced_object_id where fk.type = 'F' and (c.name like @TableName  ) and (convert(int, fk.is_disabled)) = 1 select @ElementCount = @@ROWCOUNT 
8select @ElementIndex = 1 while @ElementIndex <= @ElementCount  and @WarFehlerhaft = 0 begin  select top 1 @TabAktuell = bu.Ident2 from @elements bu where
9 bu.ElementIndex = @ElementIndex  BEGIN TRY select @SQL = concat('
10			alter Table ', @TabAktuell, ' with nocheck check constraint all ') exec QBM_PExecuteSQLWithRetry_LLP
11 @SQLStatement = @SQL , @LockTimeout_ms = 2500  , @MaxWaitTimeForLock_s = 10 , @ProcIDForJournal = default , @HandleErrorSilent = 0   , @ExecuteWithTransact
12 = 0 select @CountElementsChanged += 1 END TRY BEGIN CATCH if @HandleErrorSilent = 0 begin exec QBM_PSessionErrorAdd default if dbo.QBM_FGISessionErrorIsDeadlock
13(default) = 0 begin insert into @ErrorBuffer (ErrorMessage, ErrorSeverity, ErrorState, ErrorNumber , ProcedureName, ProcedureLine, MessageDate , GenProcID
14, RepeatCounter, IsReThrow, SourceCode) select '#LDS#Possible invalid foreign keys, run consistency checks: {0}|', ERROR_SEVERITY(), ERROR_STATE(), 50000
15 , ERROR_PROCEDURE() , ERROR_LINE(), GETUTCDATE() , null, 0, 0, null exec QBM_PSessionErrorAdd @ErrorBuffer exec QBM_PJournal 'SessionError', @@procid,
16 'E', @DebugLevel, 20 end  end  select @WarFehlerhaft = 1 END CATCH select @ElementIndex += 1 end  if @CountElementsChanged > 0 and exists (select top 
171 1 from sys.objects o where o.name = 'QBM_PJournal' and type = 'P' ) begin select @JournalMessage = '#LDS#System elements modified by {0}, pattern {1}, elements affected {2}.|'
18 + isnull(OBJECT_NAME(@@procid), '') + '|' + @TableName + '|' + dbo.QBM_FCVIntToString(@CountElementsChanged) + '|'  if not exists (select top 1 1 from
19 DialogDatabase where IsMainDatabase = 1 and UpdatePhase <> 0) and not exists (select top 1 1 from sys.tables t with (readpast) join sys.columns c with
20 (readpast) on t.object_id = c.object_id where t.name = 'DialogDatabase' and c.name = 'InitialMigrationRunning' ) begin exec QBM_PJournal @JournalMessage
21, @@procid, @MessageType, @DebugLevel, 20 end else begin  exec QBM_PJournal @JournalMessage, @@procid, 'I', 'I' end end exec QBM_PIndicatorChange 1 END
22 TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT
23 END CATCH endLabel:  return (@WarFehlerhaft) end 
24

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.137

has TRY/CATCH error handling

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

Declared parameters

ParameterTypeDirection
@TableNamenvarchar(64)input
@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: @TableName @HandleErrorSilent @force @TabAktuell @elements @ElementCount @ElementIndex @JournalMessage @DebugLevel @MessageType @ErrorMessage @ErrorSeverity @ErrorState @WarFehlerhaft @CountElementsChanged @ErrorBuffer @SQL @ROWCOUNT @SQLStatement @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @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_ZConstraintEnableSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_ZConstraintEnablesource text referenceinserts DBQueue tasks, has TRY/CATCH error handling