dbo.QBM_ZCheckStatistics

SQL_STORED_PROCEDURE

Created 2025-06-27T17:58:58.940 · modified 2026-04-14T23:20:29.717 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
@SlotNumberintno
@dummy1varcharno
@dummy2varcharno
@dummyGenProcIDvarcharno

Referenced objects

SchemaObjectColumn/minorClass
QBM_PExecuteSQLWithRetry_LLPOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE

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_ZCheckStatistics (@SlotNumber int , @dummy1 varchar(38) , @dummy2 varchar(38) , @dummyGenProcID varchar(38) ) as begin
2  declare @db nvarchar(128) select @db = db_name() declare @autocreate int select @autocreate = convert(int, DATABASEPROPERTYEX (@db, N'IsAutoCreateStatistics'
3)) declare @autoupdate int select @autoupdate = convert(int, DATABASEPROPERTYEX (@db, N'IsAutoupdateStatistics'))  declare @SQLcmd nvarchar(max) declare
4 @muster nvarchar(200) declare @ElementBuffer QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int BEGIN TRY select @muster = N'drop statistics [%schema%].[%table%].[%stat%]'
5 if @autocreate = 0 and @autoupdate = 0 begin insert into @ElementBuffer (ContentFull) select replace(replace(replace(@Muster, N'%schema%' , sc.name), 
6N'%table%', t.name), N'%stat%', i.name) from sys.tables t join sys.stats i with (nolock) on t.object_id = i.Object_id join sys.schemas sc on t.schema_id
7 = sc.Schema_id where i.auto_created = 1  select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select 
8top 1 @SQLcmd = bu.ContentFull from @ElementBuffer bu where bu.ElementIndex = @ElementIndex  exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLcmd 
9, @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 select @ElementIndex += 1 end  end
10  if @autocreate = 1 begin EXEC sp_autostats dialogdbqueue, 'ON' EXEC sp_autostats Jobqueue, 'ON' EXEC sp_autostats JobTreeParamColl, 'ON' end END TRY 
11BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 
12

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:29.717

has TRY/CATCH error handling

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

Declared parameters

ParameterTypeDirection
@SlotNumberintinput
@dummy1varchar(38)input
@dummy2varchar(38)input
@dummyGenProcIDvarchar(38)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: @SlotNumber @dummy1 @dummy2 @dummyGenProcID @db @autocreate @autoupdate @SQLcmd @muster @ElementBuffer @ElementCount @ElementIndex @Muster @ROWCOUNT @SQLStatement @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @procid @HandleErrorSilent

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.