dbo.QBM_PIndexDrop

SQL_STORED_PROCEDURE

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

Open formatted source/search result

Parameters

NameTypeOutput
@TablePatternnvarcharno
@indexPatternnvarcharno

Referenced objects

SchemaObjectColumn/minorClass
QBM_PExecuteSQLWithRetry_LLPOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
dboQBM_FGIObjectIsDropableOBJECT_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_PIndexDrop (@TablePattern nvarchar(255)= '', @indexPattern nvarchar(255) = '')  as begin  declare @SQLcmd nvarchar(1024
2) declare @DebugSwitch int = 0 declare @ElementBufferIndex QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int  SET XACT_ABORT OFF BEGIN
3 TRY insert into @ElementBufferIndex(ContentFull) select CONCAT( 'drop index if exists ' , s.name , N'."' , t.name , N'"."' , case when i.name like '%"%'
4 then N'[' + i.name + N']' else i.name end , '"' ) from sys.indexes i with (readpast) join sys.tables t with (readpast) on i.object_id=t.object_id join
5 sys.schemas s with (readpast) on t.schema_id = s.schema_id where i.is_primary_key = 0 and i.is_hypothetical = 0  and i.type not in (3,4,5,6) and i.type_desc
6 <> 'HEAP' and dbo.QBM_FGIObjectIsDropable (s.Schema_id) = 1 and i.name like @indexPattern and t.name like @TablePattern and t.is_memory_optimized = 0 
7and indexproperty(t.object_id, i.name, 'IsStatistics') = 0 union all  select CONCAT( 'if exists(select top 1 1 
8					from sys.stats with (readpast)
9					where  name = '''
10, i.name , '''
11				  )
12					 begin
13						drop statistics ' , s.name , N'."' , t.name , N'"."' , i.name , '"
14					 end
15					 ' ) from sys.stats i with
16 (readpast) join sys.tables t on i.object_id=t.object_id join sys.schemas s on t.schema_id = s.schema_id left outer join sys.indexes ii on ii.object_id
17 = t.object_id and ii.name = i.name where dbo.QBM_FGIObjectIsDropable (s.Schema_id) = 1 and ii.name is null and i.name like @indexPattern and t.name like
18 @TablePattern and t.is_memory_optimized = 0 and indexproperty(t.object_id, i.name, 'IsStatistics') = 1 select @ElementCount = @@ROWCOUNT select @ElementIndex
19 = 1 while @ElementIndex <= @ElementCount begin select top 1 @SQLcmd = bu.ContentFull from @ElementBufferIndex bu where bu.ElementIndex = @ElementIndex
20 if @DebugSwitch > 0 begin print @SQLcmd end  exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLcmd , @LockTimeout_ms = 2500  , @MaxWaitTimeForLock_s
21 = 10 , @ProcIDForJournal = default , @HandleErrorSilent = 0  , @ExecuteWithTransact = 0 select @ElementIndex += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd
22 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 
23

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

has TRY/CATCH error handling

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

Declared parameters

ParameterTypeDirection
@TablePatternnvarchar(255)input
@indexPatternnvarchar(255)input

DML targets

INSERT into

Read/join references

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @TablePattern @indexPattern @SQLcmd @DebugSwitch @ElementBufferIndex @ElementCount @ElementIndex @ROWCOUNT @SQLStatement @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @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.

Referencing objectRelationEvidence
dbo.QBM_PColumnChangeDataTypeSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PColumnDropSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PDBQueueCompressSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PIndexCreateSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PModuleRemoveSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_TDQBMUniqueGroupSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_TDQBMUniqueGroupHasColumnSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_TUQBMUniqueGroupSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_PColumnChangeDataTypesource text referencehas TRY/CATCH error handling
dbo.QBM_PColumnCustomRemovesource text referencehas TRY/CATCH error handling
dbo.QBM_PColumnDropsource text referencehas TRY/CATCH error handling
dbo.QBM_PDBQueueCompresssource text referenceinserts DBQueue tasks, uses session context values, has TRY/CATCH error handling
dbo.QBM_PIndexCreatesource text referencehas TRY/CATCH error handling
dbo.QBM_PModuleRemovesource text referencehas TRY/CATCH error handling
dbo.QBM_TDQBMUniqueGroupsource text referenceinserts DBQueue tasks, uses session context values, has TRY/CATCH error handling
dbo.QBM_TDQBMUniqueGroupHasColumnsource text referenceinserts DBQueue tasks, uses session context values, has TRY/CATCH error handling
dbo.QBM_TUQBMUniqueGroupsource text referenceinserts DBQueue tasks, uses session context values, has TRY/CATCH error handling