dbo.QBM_PIndexEnable
SQL_STORED_PROCEDURE
Created 2025-06-27T17:57:28.787 · modified 2026-04-14T23:20:25.420 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@tablepattern | nvarchar | no |
@IndexPattern | nvarchar | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| DialogTable | OBJECT_OR_COLUMN | ||
| QBM_PExecuteSQLWithRetry_LLP | OBJECT_OR_COLUMN | ||
| QBM_PGIDBServerIndexRebuildOpt | OBJECT_OR_COLUMN | ||
| QBM_PSessionErrorAdd | OBJECT_OR_COLUMN | ||
| QBM_PSetRowLockOnly | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1 create procedure QBM_PIndexEnable ( @tablepattern nvarchar(64) = '%' , @IndexPattern nvarchar(64) = '%' ) as begin declare @TableName varchar 2(30) declare @indexname varchar(30) declare @SQLCmd nvarchar(max) declare @RebuildOptions nvarchar(max) declare @DebugSwitch int = 0 SET XACT_ABORT OFF 3 BEGIN TRY if @@TRANCOUNT > 0 begin goto endlabel end select @TableName = '#' while @TableName > ' ' begin select @TableName = null select top 1 @TableName 4 = t.name , @indexname = i.name from sys.tables t join sys.indexes i on t.object_id = i.object_id and t.type_desc = 'USER_TABLE' join DialogTable tt on 5 t.name = tt.TableName where i.is_disabled = 1 and t.name like @tablepattern and i.name like @IndexPattern and t.is_memory_optimized = 0 and i.is_hypothetical 6 = 0 and i.type not in (3,4,5,6) if @TableName is null begin continue end exec QBM_PGIDBServerIndexRebuildOpt @TableName, @RebuildOptions output select 7 @SQLCmd = 'ALTER INDEX ALL on ' + @TableName + ' SET (ALLOW_PAGE_LOCKS = ON)' if @DebugSwitch > 0 print @SQLCmd exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement 8 = @sqlcmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 , @ExecuteWithTransact 9 = 0 if @IndexPattern = '%' begin select @SQLCmd = 'ALTER INDEX ALL on ' + @TableName + @RebuildOptions if @DebugSwitch > 0 print @SQLCmd exec QBM_PExecuteSQLWithRetry_LLP 10 @SQLStatement = @sqlcmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 , @ExecuteWithTransact 11 = 0 end else begin select @indexname = '#' while @indexname > ' ' begin select @indexname = null select top 1 @indexname = i.name from sys.tables t join 12 sys.indexes i on t.object_id = i.object_id and t.type_desc = 'USER_TABLE' join DialogTable tt on t.name = tt.TableName where i.is_disabled = 1 and t.name 13 = @TableName and i.name like @IndexPattern and i.name > ' ' and i.is_hypothetical = 0 and i.type not in (3,4,5,6) if @indexname is null begin continue 14 end select @SQLCmd = 'ALTER INDEX "' + @indexname + '" on ' + @TableName + @RebuildOptions if @DebugSwitch > 0 print @SQLCmd exec QBM_PExecuteSQLWithRetry_LLP 15 @SQLStatement = @sqlcmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 , @ExecuteWithTransact 16 = 0 end end exec QBM_PSetRowLockOnly @TableName end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH 17 endLabel: return end 18
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:20:25.420
has TRY/CATCH error handling
Summary: calls QBM_PGIDBServerIndexRebuildOpt, QBM_PExecuteSQLWithRetry_LLP, QBM_PSetRowLockOnly, QBM_PSessionErrorAdd; reads/joins sys, DialogTable
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@tablepattern | nvarchar(64) | input |
@IndexPattern | nvarchar(64) | input |
DML targets
None extracted.Called routines
Read/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: None extracted.
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: None extracted.
Variables: @tablepattern @IndexPattern @TableName @indexname @SQLCmd @RebuildOptions @DebugSwitch @TRANCOUNT @SQLStatement @sqlcmd @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @procid @HandleErrorSilent @ExecuteWithTransact
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.