dbo.QBM_ZProcessMarkDelete
SQL_STORED_PROCEDURE
Created 2025-06-27T17:58:58.740 · modified 2026-04-14T23:20:29.473 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@SlotNumber | int | no |
@dummy1 | varchar | no |
@dummy2 | varchar | no |
@GenProcID | varchar | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| DialogProcess | OBJECT_OR_COLUMN | ||
| DialogProcessSubstitute | OBJECT_OR_COLUMN | ||
| JobHistory | OBJECT_OR_COLUMN | ||
| QBM_PSessionErrorAdd | OBJECT_OR_COLUMN | ||
| QBM_VDialogProcessCollection | OBJECT_OR_COLUMN | ||
| QBM_YSingleGuid | TYPE | ||
| dbo | QBM_FGIModuleExists | OBJECT_OR_COLUMN | |
| dbo | QBM_FGISessionErrorRethrow | 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_ZProcessMarkDelete (@SlotNumber int , @dummy1 varchar(38) = '' , @dummy2 varchar(38) = '' , @GenProcID varchar(38) = '' 2 ) as begin declare @Xdate DATETIME = getutcdate() declare @XUser NVARCHAR(64) = object_name(@@procid) declare @UnfinProcsNoRuns QBM_YSingleGuid declare 3 @rowCount int = 1 declare @DebugSwitch int = 0 declare @Stmnt nvarchar(max) if not exists (select top 1 1 from DialogProcess where ProcessState not in 4 ('E','F')) begin goto ende end SET XACT_ABORT OFF set LOCK_TIMEOUT 500 BEGIN TRY if isnull(@XUser, '') = '' set @xuser = 'UNKNOWN' select @Stmnt = ' 5 select 6 P.GenprocID, 7 isnull(SubstInfo.ProcessStateInfo, 0) as IntProperty -- 0=no subst; 1=subst proc is done E; 2=subst proc is done F; 3=subst proc is unfinished too 8 from DialogProcess P 9 left outer join ( 10 select GenprocIDOrigin 11 , max(case 12 when psub.ProcessState = ''F'' then 2 13 when psub.ProcessState = ''E'' then 1 14 else 3 end 15 ) as ProcessStateInfo 16 from QBM_VDialogProcessCollection v with (readpast) 17 join Dialogprocess PSub on PSub.GenProcID = v.GenProcIDNew 18 where v.GenProcIDOrigin <> v.GenProcIDNew 19 group by GenprocIDOrigin 20 ) SubstInfo on SubStInfo.GenProcIDOrigin = p.GenprocID 21 where P.ProcessState not in (''E'',''F'') --E=Ended;L=Frozen;F=Failed 22 and not exists (select top 1 genprocid from DialogDBQueue with (readpast) where genprocid = P.GenProcID) 23 and not exists (select top 1 genprocid from QBMDBQueueCurrent with (readpast) where genprocid = P.GenProcID and Slotnumber<>0) 24 and not exists (select top 1 genprocid from QBMDBQueuePond with (readpast) where genprocid = P.GenProcID) 25 and not exists (select top 1 genprocid from JobQueue with (readpast) where genprocid = P.GenProcID) 26 and not exists (select top 1 genprocid from DialogDeferredOperation with (readpast) where genprocid = P.GenProcID) 27 ' 28 if dbo.QBM_FGIModuleExists('QER') = 1 begin select @Stmnt = concat(@Stmnt, ' and not exists (select top 1 genprocid from PersonWantsOrg with (readpast) where genprocid = P.GenProcID)' 29) end Insert into @UnfinProcsNoRuns(UID_SingleGuid, IntProperty) exec sp_executesql @Stmnt if (@DebugSwitch > 0) begin select 'debug 1 cnt @UnfinProcsNoRuns' 30, count(*) cnt from @UnfinProcsNoRuns select 'debug 1b @UnfinProcsNoRuns', * from @UnfinProcsNoRuns end select @rowcount = 1 while (@rowCount > 0) begin 31 set @rowCount = 0 update DialogProcess set ProcessState = case when isnull(ErrorInfo, 0) = 0 then 'E' else 'F' end from DialogProcess P join @UnfinProcsNoRuns 32 up on P.GenprocID = up.UID_SingleGuid left outer join ( select GenprocID, max(sign(waserror)) as ErrorInfo from JobHistory group by GenprocID ) JobH on 33 JobH.GenProcID = P.GenprocID where up.IntProperty = 0 set @rowCount += @@Rowcount if (@DebugSwitch > 0) begin select 'after 1)', @rowCount as [RowCount] 34 end update DialogProcess set ProcessState = case when IntProperty = 1 then 'E' else 'F' end from DialogProcess P join @UnfinProcsNoRuns up on P.GenprocID 35 = up.UID_SingleGuid where up.IntProperty in (1, 2) set @rowCount += @@Rowcount if (@DebugSwitch > 0) begin select 'after 2)', @rowCount as [RowCount] 36 select distinct 'Debug 2 Subst', p.GenProcID, p.ProcessState, P.Displayname from DIalogProcess P join @UnfinProcsNoRuns up on up.UID_SingleGuid = P.GenProcID 37 join DialogProcessSubstitute S on P.GenProcID in (S.GenProcIDNew, S.GenProcIDOrigin) select count(*) cnt, ProcessState from Dialogprocess P join @UnfinProcsNoRuns 38 up on up.UID_SingleGuid = P.GenProcID group by ProcessState end if (@rowCount > 0 and exists (select top 1 1 from @UnfinProcsNoRuns where IntProperty 39 = 3)) begin update @UnfinProcsNoRuns set IntProperty = -1 where IntProperty <> 3 update @UnfinProcsNoRuns set IntProperty = isnull(SubstInfo.ProcessStateInfo 40, 0) from @UnfinProcsNoRuns OldRun left outer join ( select GenprocIDOrigin, max(case when psub.ProcessState = 'F' then 2 when psub.ProcessState = 'E' 41then 1 else 3 end) as ProcessStateInfo from QBM_VDialogProcessCollection v WITH (READPAST) join Dialogprocess PSub on PSub.GenProcID = v.GenProcIDNew where 42 v.GenProcIDOrigin <> v.GenProcIDNew group by GenprocIDOrigin ) SubstInfo on SubStInfo.GenProcIDOrigin = OldRun.UID_SingleGuid where OldRun.IntProperty 43 = 3 and OldRun.IntProperty <> isnull(SubstInfo.ProcessStateInfo, 0) set @rowCount = @@Rowcount if (@DebugSwitch > 0) begin select 'post processing, rowcount after getting post proc jobs' 44 , @rowCount select 'Group by IntProperty', IntProperty, count(*) cnt, min(UID_SingleGuid) as MinP, max(UID_SingleGuid) as MaxP from @UnfinProcsNoRuns 45group by IntProperty end end else begin set @rowCount = 0 end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000 46) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: return end 47
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.473
has TRY/CATCH error handling
Summary: calls QBM_PSessionErrorAdd; writes INSERT into, UPDATE DialogProcess; reads/joins DialogProcess, QBM_VDialogProcessCollection, Dialogprocess, DialogDBQueue, QBMDBQueueCurrent…
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@SlotNumber | int | input |
@dummy1 | varchar(38) | input |
@dummy2 | varchar(38) | input |
@GenProcID | varchar(38) | input |
DML targets
INSERT into UPDATE DialogProcessCalled 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: @SlotNumber @dummy1 @dummy2 @GenProcID @Xdate @XUser @procid @UnfinProcsNoRuns @rowCount @DebugSwitch @Stmnt @xuser @rowcount @Rowcount @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.
No reverse dependencies extracted.