dbo.QBM_FGIJobQueueTopJob

SQL_SCALAR_FUNCTION

Created 2025-06-27T18:00:59.723 · modified 2026-04-14T23:20:31.117 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
varcharyes
@uid_treevarcharno

Referenced objects

SchemaObjectColumn/minorClass
dboJobQueueOBJECT_OR_COLUMN
dboJobQueueUID_JobOBJECT_OR_COLUMN
dboJobQueueUID_TreeOBJECT_OR_COLUMN
dboJobQueueReady2EXEOBJECT_OR_COLUMN
dboJobQueueUID_JobErrorOBJECT_OR_COLUMN
dboJobQueueUID_JobSuccessOBJECT_OR_COLUMN
dboJobQueueIsSplitOnlyOBJECT_OR_COLUMN
dboJobQueueWasErrorOBJECT_OR_COLUMN
dboJobQueueIsRootJobOBJECT_OR_COLUMN
dboJobQueueErrorMessagesOBJECT_OR_COLUMN
dboQBM_YJobQueueShadowTYPE

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   function dbo.QBM_FGIJobQueueTopJob (@uid_tree varchar(38)) returns varchar(38)  with schemabinding as begin  declare @uid_s varchar
2(38) declare @uid_e varchar(38) declare @uid_j varchar(38) = '' declare @ready2Exe nvarchar(16) = N'' declare @ready2Exe_S nvarchar(16) declare @ready2Exe_E
3 nvarchar(16)  declare @WasError bit  declare @JobQueueShadow dbo.QBM_YJobQueueShadow           insert into @JobQueueShadow(UID_Job, Ready2Exe, UID_JobError
4, UID_JobSuccess, IsRootJob, WasError, IsSplitOnly , LenErrorMessage , IsRecordModified   , UID_Tree, GenProcID, JobChainName ) select isnull(q.UID_Job
5, ''), isnull(q.Ready2EXE, N''), isnull(q.UID_JobError, ''), isnull(q.UID_JobSuccess, ''), q.IsRootJob, q.WasError, q.IsSplitOnly , len(isnull(q.ErrorMessages
6, '')) , 0  , @uid_tree, @uid_tree, @uid_tree from dbo.JobQueue q with (nolock) where q.UID_Tree = @uid_tree select top 1 @uid_j = uid_job, @ready2Exe 
7= ready2Exe from @JobQueueShadow s  where ((uid_job not in (select UID_JobError from @JobQueueShadow s ) and uid_job not in (select UID_JobSuccess from
8 @JobQueueShadow s) ) or (isRootJob = 1) )  if exists (select top 1 1 from @JobQueueShadow j left outer join @JobQueueShadow s on j.UID_JobSuccess = s.UID_Job
9 where j.UID_JobSuccess > ' ' and s.UID_Job is null ) or exists (select top 1 1 from @JobQueueShadow j left outer join @JobQueueShadow e on j.UID_JobError
10 = e.UID_Job where j.UID_JobError > ' ' and e.UID_Job is null ) begin goto error end     if @ready2Exe not in ( N'FINISHED', N'DELETE', N'HISTORY') begin
11  goto schluss end kreisel:  if @uid_j = '' begin goto error end   if exists (select top 1 1 from @JobQueueShadow a where a.UID_Job = @uid_j and a.IsRecordModified
12 = 1  ) begin  goto error end   update @JobQueueShadow set IsRecordModified = 1 where UID_Job = @uid_j  select @uid_s = s.UID_JobSuccess , @uid_e = s.UID_JobError
13  , @ready2Exe = s.Ready2Exe , @WasError = sign(s.WasError + s.LenErrorMessage * s.IsSplitOnly) from @JobQueueShadow s where s.UID_Job = @uid_j if @ready2Exe
14 in ( N'TRUE' , N'LOADED', N'PROCESSING', N'FALSE', N'FROZEN' )  begin goto schluss end  if @uid_s > ' ' begin select top 1 @ready2Exe_S = s.Ready2Exe 
15from @JobQueueShadow s where s.UID_Job = @uid_s end else begin select @ready2Exe_S = N'' end if @uid_e > ' ' begin select top 1 @ready2Exe_E = s.Ready2Exe
16 from @JobQueueShadow s where uid_job = @uid_e end else begin select @ready2Exe_E = N'' end        if @ready2Exe_S in ( N'PROCESSING', N'TRUE', N'FROZEN'
17) begin select @uid_j = @uid_s goto schluss end if @ready2Exe_E in ( N'PROCESSING', N'TRUE', N'FROZEN') begin select @uid_j = @uid_e goto schluss end  
18 if @WasError = 1 and @ready2Exe_E = N'MISSING' and @ready2Exe_S in( N'LOADED', N'FALSE') begin select @uid_j = @uid_e goto schluss end  if @WasError =
19 0 and @ready2Exe_S = N'MISSING' and @ready2Exe_E in( N'LOADED', N'FALSE') begin select @uid_j = @uid_s goto schluss end  if @ready2Exe_S = N'FALSE' and
20 @ready2Exe_E in ( N'FALSE', '') and @wasError = 0 begin select @uid_j = @uid_s goto schluss end if @ready2Exe_E = N'FALSE' and @ready2Exe_S in ( N'FALSE'
21, '') and @wasError = 1 begin select @uid_j = @uid_e goto schluss end  if @ready2Exe in ( N'FINISHED', N'DELETE', N'HISTORY') begin if @ready2Exe_S = N''
22 begin  select @uid_j = @uid_e goto kreisel end if @ready2Exe_E = N'' begin  select @uid_j = @uid_s goto kreisel end end if @ready2Exe_S in ( N'FINISHED'
23, N'DELETE', N'HISTORY') begin select @uid_j = @uid_s goto kreisel end  if @ready2Exe_E in ( N'FINISHED', N'DELETE', N'HISTORY') begin select @uid_j = 
24@uid_e goto kreisel end   if @ready2Exe_S = N'LOADED' and @ready2Exe_E = N'LOADED' begin if @WasError = 1 begin select @uid_j = @uid_e end else begin select
25 @uid_j = @uid_s end goto schluss end if @ready2Exe_S = N'LOADED' begin select @uid_j = @uid_s goto schluss end if @ready2Exe_E = N'LOADED' begin select
26 @uid_j = @uid_e goto schluss end  goto schluss  error: select @uid_j = '' schluss: return (@uid_j)  end 
27

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

None extracted.

Summary: writes INSERT into; reads/joins JobQueue

Declared parameters

ParameterTypeDirection
varchar(38)OUTPUT
@uid_treevarchar(38)input

DML targets

INSERT into

Called routines

None extracted.

Read/join references

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @uid_tree @uid_s @uid_e @uid_j @ready2Exe @ready2Exe_S @ready2Exe_E @WasError @JobQueueShadow @wasError

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_PJobQueueInit_iSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_PJobQueueLoadSQL expression dependencydbo · OBJECT_OR_COLUMN