dbo.QBM_ZCheckDefaultZero

SQL_STORED_PROCEDURE

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

Open formatted source/search result

Parameters

NameTypeOutput
@SlotNumberDummyintno
@TablePatternvarcharno
@Dummy2varcharno
@DummyGenProcIDvarcharno

Referenced objects

SchemaObjectColumn/minorClass
DialogTableOBJECT_OR_COLUMN
QBM_PExecuteSQLWithRetry_LLPOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_VHeavyLoadTablesOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
dboQBM_FGIColumnExistsInSchemaOBJECT_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_ZCheckDefaultZero ( @SlotNumberDummy int , @TablePattern varchar(38) , @Dummy2 varchar(38) , @DummyGenProcID varchar
2(38) ) as begin declare @SQLcmd nvarchar(max) declare @DebugSwitch int = 0 declare @ElementLast int declare @ElementCount int declare @ElementIndex int
3 BEGIN TRY declare @ElementBuffer_definition QBM_YCursorBuffer insert into @ElementBuffer_definition (ContentFull) select concat( 'sp_bindefault ''DezimalNULL'', '''
4 , c.table_name , '.' , c.column_name , '''')  from information_schema.columns c join information_schema.tables t on t.table_name = c.table_name join DialogTable
5 tt on t.TABLE_NAME = tt.TableName  join sys.tables st on t.TABLE_NAME = st.name join sys.columns sc on st.object_id = sc.object_id and sc.name = c.COLUMN_NAME
6 where t.table_type = 'BASE TABLE' and c.data_type in ('bit', 'int', 'real', 'float', 'bigint') and c.COLUMN_DEFAULT is null and t.TABLE_NAME like @TablePattern
7 and t.TABLE_NAME not in (select TableName from QBM_VHeavyLoadTables  ) and sc.is_identity = 0 select @ElementCount = @@ROWCOUNT select @ElementIndex =
8 @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin select top 1 @SQLcmd = bu.ContentFull from @ElementBuffer_definition
9 bu where bu.ElementIndex = @ElementIndex if @DebugSwitch > 0 begin print @SQLcmd end exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLcmd , @LockTimeout_ms
10 = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 select @ElementIndex += 1 end   declare @ElementBuffer_value
11 QBM_YCursorBuffer insert into @ElementBuffer_value (ContentFull) select concat('updat','e ' , c.table_name , ' set ' , c.column_name , ' = 0 ' , case 
12when dbo.QBM_FGIColumnExistsInSchema(t.TABLE_NAME, 'XDateUpdated') = 1 and c.COLUMN_NAME not like 'X[d,u][a,s][t,e][e,r]updated' then concat('' , '	--34101
13								, XDateUpdated = getutcdate()
14								, XUserUpdated = '''
15, object_name(@@procid) , '''
16								') else '' end ,' where ' , c.column_name , ' is null ' ) from information_schema.columns c join information_schema.tables
17 t on t.table_name = c.table_name join DialogTable tt on t.TABLE_NAME = tt.TableName  join sys.tables st on t.TABLE_NAME = st.name join sys.columns sc 
18on st.object_id = sc.object_id and sc.name = c.COLUMN_NAME where t.table_type = 'BASE TABLE' and c.data_type in ('bit', 'int', 'real', 'float', 'bigint'
19) and (  c.COLUMN_DEFAULT = N'0' or c.COLUMN_DEFAULT = N'(0)'  or c.COLUMN_DEFAULT = N'((0))' or c.COLUMN_DEFAULT like N'create default DezimalNULL as 0%'
20 ) and t.TABLE_NAME like @TablePattern and t.TABLE_NAME not in (select TableName from QBM_VHeavyLoadTables  ) and sc.is_identity = 0 select @ElementCount
21 = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin select top
22 1 @SQLcmd = bu.ContentFull from @ElementBuffer_value bu where bu.ElementIndex = @ElementIndex if @DebugSwitch > 0 begin print @SQLcmd end exec QBM_PExecuteSQLWithRetry_LLP
23 @SQLStatement = @SQLcmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 select @ElementIndex
24 += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 
25

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

has TRY/CATCH error handling

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

Declared parameters

ParameterTypeDirection
@SlotNumberDummyintinput
@TablePatternvarchar(38)input
@Dummy2varchar(38)input
@DummyGenProcIDvarchar(38)input

DML targets

INSERT into

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @SlotNumberDummy @TablePattern @Dummy2 @DummyGenProcID @SQLcmd @DebugSwitch @ElementLast @ElementCount @ElementIndex @ElementBuffer_definition @ROWCOUNT @IDENTITY @SQLStatement @LockTimeout_ms @MaxWaitTimeForLock_s @ProcIDForJournal @procid @HandleErrorSilent @ElementBuffer_value

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.