dbo.QBM_TIJobqueue

SQL_TRIGGER parent JobQueue

Created 2025-06-27T18:01:01.203 · modified 2026-04-14T23:23:08.383 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
No parameters.

Referenced objects

SchemaObjectColumn/minorClass
insertedOBJECT_OR_COLUMN
jobchainOBJECT_OR_COLUMN
jobqueueOBJECT_OR_COLUMN
JobQueueStatsOBJECT_OR_COLUMN
QBM_PJobCreate_HOFireEventOBJECT_OR_COLUMN
QBM_PJobQueueOverviewSetInvOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
QBM_YDBQueueRawTYPE
QBM_YParameterListTYPE
QBMJobqueueOverviewOBJECT_OR_COLUMN
dboQBM_FCVStringToGUIDOBJECT_OR_COLUMN
dboQBM_FGIConfigparmValueOBJECT_OR_COLUMN
dboQBM_FGISessionContextOBJECT_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   trigger QBM_TIJobqueue on JobQueue  for Insert not for Replication as begin declare @JobchainName nvarchar(255) declare @uid_job varchar
2(38) declare @SQLWhereClause nvarchar(1000) declare @GenProcID varchar(38) = dbo.QBM_FGISessionContext('') declare @JustNow datetime = getutcdate()   declare
3 @LimitedChains QBM_YParameterList    declare @ElementLast int declare @ElementCount int declare @ElementIndex int declare @XUser nvarchar(64) = object_name
4(@@procid) declare @Xdate datetime = getutcdate() BEGIN TRY if exists (select top 1 1 from inserted) goto start return start:  declare @DBQueueElements_01
5 QBM_YDBQueueRaw insert into @DBQueueElements_01(Object, SubObject, GenProcID) select dbo.QBM_FCVStringToGUID('', x.QueueName), null, @GenProcID from (
6 select i.Queue as QueueName from inserted i group by i.Queue ) as x  delete  @DBQueueElements_01 from @DBQueueElements_01 q join QBMJobqueueOverview o
7 with (readpast) on q.Object = o.UID_QBMJobqueueOverview where o.IsInvalid = 1 if exists (select top 1 1 from @DBQueueElements_01 ) begin   exec QBM_PJobQueueOverviewSetInv
8 @DBQueueElements_01 end  if '1' = dbo.QBM_FGIConfigparmValue('Common\JobQueueStats') begin select @JustNow = GetUTCDate() insert into JobQueueStats (UID_JobQueueStats
9, queue , jobYear, jobMonth , jobDay , jobHour , countInserted, countActivated, countDeleted ) select 'XX'+convert(varchar(64), newid()), d.queue , year
10(@JustNow) ,month(@JustNow) ,day( @JustNow) , datepart(hh,@JustNow) , (-1) * count(*) , 0, 0 from inserted d group by d.queue end  if exists (select top
11 1 1 from inserted i where i.LimitationWarning + i.LimitationCount > 0 ) begin    if exists (select top 1 1 from inserted i where i.LimitationCount > 0
12 ) begin  insert into @limitedChains (ContentShort ) select name from jobchain where limitationcount > 0 if @@rowcount = 0 begin goto NachLimitationCount
13 end  merge into jobqueue as t using  ( select z.Jobchainname, max(z.AltBestand) * (-1) as AlteOverlimit from ( select q.limitationcount, l.ContentShort
14 as Jobchainname , case ready2exe when N'OVERLIMIT' then 1 else 0 end as altbestand from Jobqueue q with (readpast, index (QBM_XI7JobQueue)) join @limitedChains
15 l on q.jobchainname = l.ContentShort  where q.Ready2EXE like N'[^DH][^A]%'  and q.IsRootJob = 1 and q.limitationcount > 0  and q.JobChainName in (select
16 distinct i.JobChainName from inserted i ) ) as z group by z.Jobchainname having count(*) > max(z.LimitationCount) ) as s on t.JobChainName = s.JobChainName
17 and t.Ready2EXE = N'TRUE' and t.IsRootJob = 1 and t.LimitationCount > 0 when matched then update set t.ready2exe = N'OVERLIMIT' , t.xtouched = 'N' , t.xdateupdated
18 = dateadd(ss, s.alteOverlimit , @JustNow) ; if @@rowcount > 0 begin  declare @ElementBufferMulti_01 QBM_YCursorBuffer insert into @ElementBufferMulti_01
19 (UID1) select min(q.UID_Job)  from JobQueue q with (readpast) where q.IsRootJob = 1 and q.Ready2EXE = N'OVERLIMIT' and q.XDateUpdated = @JustNow group
20 by q.Queue, q.JobChainName select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while
21 @ElementIndex <= @ElementLast begin select top 1 @uid_job = bu.UID1 from @ElementBufferMulti_01 bu where bu.ElementIndex = @ElementIndex select @SQLWhereClause
22 = N' uid_job = ''' + rtrim(@uid_job) + N''''  exec QBM_PJobCreate_HOFireEvent 'JobQueue', @SQLWhereClause, 'OVERLIMITDETECT', @GenProcID = @GenProcID 
23, @ObjectKeysAffected = DEFAULT select @ElementIndex += 1 end  end end     NachLimitationCount:    if exists (select top 1 1 from inserted i where i.LimitationWarning
24 > 0 ) begin declare @ElementBufferMulti_02 QBM_YCursorBuffer insert into @ElementBufferMulti_02 (ContentShort, UID1) select x.JobChainName, min(x.UID_Job
25)  from (  select i.JobChainName, i.UID_Job, i.LimitationWarning, 1 As IsNew, 0 as IsOverlimitRaised from inserted i where i.IsRootJob = 1 and i.Ready2EXE
26 like N'[^DH][^A]%'  and i.LimitationWarning > 0 union all select j.JobChainName, j.UID_Job, j.LimitationWarning, 0 as isNew ,case j.Ready2EXE when N'OVERLIMIT'
27 then 1 else 0 end as IsOverlimitRaised from JobQueue j with (readpast) join ( select distinct ii.JobChainName from inserted ii ) i on j.JobChainName =
28 i.JobChainName   where j.IsRootJob = 1 and j.Ready2EXE like N'[^DH][^A]%'  and j.LimitationWarning > 0  and Not exists (select top 1 1 from inserted i2
29 where i2.UID_Job = j.UID_Job ) ) as x group by x.JobChainName having count(*) > max(x.LimitationWarning)  and MAX(x.IsNew ) = 1  and MAX(x.IsOverlimitRaised
30) = 0 select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast
31 begin select top 1 @JobchainName = bu.ContentShort , @uid_job = bu.UID1 from @ElementBufferMulti_02 bu where bu.ElementIndex = @ElementIndex update JobQueue
32 set StartAt = dateadd(mi, 1, StartAt) , XDateUpdated = @Xdate , XUserUpdated = @XUser where UID_Job = @uid_job select @SQLWhereClause = N' uid_job = '''
33 + rtrim(@uid_job) + N'''' exec QBM_PJobCreate_HOFireEvent 'JobQueue', @SQLWhereClause, 'OVERLIMITWARNING', @GenProcID = @GenProcID , @ObjectKeysAffected
34 = DEFAULT , @checkForExisting = 1 select @ElementIndex += 1 end  end     end   END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18
35, 1) WITH NOWAIT END CATCH end 
36

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:23:08.383

creates object-layer jobs via QBM_PJobCreate* fires object-layer event via HOFireEvent uses session context values has TRY/CATCH error handling

Summary: calls QBM_PJobQueueOverviewSetInv, QBM_PJobCreate_HOFireEvent, QBM_PSessionErrorAdd; writes INSERT not, INSERT into, INSERT JobQueueStats, UPDATE JobQueue; reads/joins inserted, QBMJobqueueOverview, jobchain, Jobqueue, JobQueue; uses config Common\JobQueueStats

Declared parameters

No declared parameters in sys.parameters for this object, or metadata was not available.

DML targets

INSERT not INSERT into INSERT JobQueueStats UPDATE JobQueue

Config/session

Config: Common\JobQueueStats

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @JobchainName @uid_job @SQLWhereClause @GenProcID @JustNow @LimitedChains @ElementLast @ElementCount @ElementIndex @XUser @procid @Xdate @DBQueueElements_01 @limitedChains @rowcount @ElementBufferMulti_01 @ROWCOUNT @IDENTITY @ObjectKeysAffected @ElementBufferMulti_02 @checkForExisting

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.