dbo.QBM_FSQTriggerWatchXOrigin

SQL_SCALAR_FUNCTION

Created 2025-06-27T17:57:36.873 · modified 2026-04-14T23:20:26.833 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
nvarcharyes
@TableNamevarcharno

Referenced objects

SchemaObjectColumn/minorClass
DialogColumnOBJECT_OR_COLUMN
DialogTableOBJECT_OR_COLUMN
QBM_VQBMRelationOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
dboQBM_FCVBinaryToStringOBJECT_OR_COLUMN
dboQBM_FGIBitPatternXMarkedForDelOBJECT_OR_COLUMN
dboQBM_FGIBitPatternXOriginOBJECT_OR_COLUMN
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   function dbo.QBM_FSQTriggerWatchXOrigin(@TableName varchar(30) ) returns nvarchar(max) as begin declare @IsAssgnmentWithEvent bit declare
2 @erg nvarchar(max) = '' declare @pre nvarchar(max) = '' declare @IsCreatePendingChange int declare @TablenameWork varchar(30) declare @ElementBuffer QBM_YCursorBuffer
3 declare @ElementCount int declare @ElementIndex int declare @zeile varchar(16)  declare @PatternDelay0 varchar(64) = dbo.QBM_FCVBinaryToString(dbo.QBM_FGIBitPatternXMarkedForDel
4('|Delay|', 0) ,0) declare @PatternDelay1 varchar(64) = dbo.QBM_FCVBinaryToString(dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|', 1) ,0) declare @StringPatternOutStanding
5 varchar(16) = dbo.QBM_FCVBinaryToString(dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|',0), 0) declare @StringPatternDirect varchar(16) = dbo.QBM_FCVBinaryToString
6(dbo.QBM_FGIBitPatternXOrigin('|Direct|',0), 0) declare @isMNTable bit , @IsMAllTable bit select top 1 @isMNTable = tx.isMNTable , @IsMAllTable = tx.IsMAllTable
7 from DialogTable tx with (readpast) where tx.TableName = @TableName if @isMNTable = 1 begin  select top 1 @pre = @pre + '
8			delete /* 34049 */ @AdditionalEntries
9			insert into @AdditionalEntries(Parameter1, Parameter2)
10			 select p.XObjectKey, d.XObjectKey 
11				from deleted d join '
12 + @TableName + ' x on d.XObjectKey = x.XObjectKey
13								join ' + r.ParentTable + ' p on p.' + r.ParentColumn + ' = x.' + r.ChildColumn + '
14							where x.XOrigin = 0
15							 and d.XOrigin > 0
16
17		'
18 from QBM_VQBMRelation r where r.ChildTable = @TableName and r.IsMNRelation = 1 order by UID_QBMRelation asc  select top 1 @pre = @pre + ' 
19			  union 
20			  select p.XObjectKey, d.XObjectKey 
21				from deleted d join '
22 + @TableName + ' x on d.XObjectKey = x.XObjectKey
23								join ' + r.ParentTable + ' p on p.' + r.ParentColumn + ' = x.' + r.ChildColumn + '
24							where x.XOrigin = 0
25							 and d.XOrigin > 0
26
27		'
28 from QBM_VQBMRelation r where r.ChildTable = @TableName and r.IsMNRelation = 1 order by UID_QBMRelation desc end if @IsMAllTable = 1 begin select top 
291 @pre = @pre + '
30			delete /* 34049 */ @AdditionalEntries
31			insert into @AdditionalEntries(Parameter1, Parameter2)
32			 select p.XObjectKey, d.XObjectKey
33				from deleted d join '
34 + @TableName + ' x on d.XObjectKey = x.XObjectKey
35								join ' + r.ParentTable + ' p on p.' + r.ParentColumn + ' = x.' + r.ChildColumn + '
36							where x.XOrigin = 0
37							 and d.XOrigin > 0
38
39		'
40 from QBM_VQBMRelation r join DialogColumn c with (readpast) on r.UID_ParentColumn = c.UID_DialogColumn and c.SchemaDataLen = 38 where r.ChildTable = @TableName
41 order by UID_QBMRelation asc  select top 1 @pre = @pre + ' 
42			  union 
43			  select x.' + c.ColumnName + ', d.XObjectKey
44				from deleted d join ' 
45+ @TableName + ' x on d.XObjectKey = x.XObjectKey
46							where x.XOrigin = 0
47							 and d.XOrigin > 0
48
49		' from DialogTable t with (readpast) join
50 DialogColumn c with (readpast) on t.UID_DialogTable = c.UID_DialogTable where c.IsDynamicFK = 1 and t.TableName = @TableName end   insert into @ElementBuffer
51 (Ident1  , Bit1  , Int1  ) select t.TableName , t.isAssignmentWithEvent , sign(t.PendingChangeBehavior & 0x01)  from DialogTable t with (readpast) where
52 t.TableName = @TableName and t.TableType = 'T'  and t.IsDeactivatedByPreProcessor = 0 union select v.TableName , v.isAssignmentWithEvent , sign(v.PendingChangeBehavior
53 & 0x01) from DialogTable v with (readpast) where v.UID_DialogTableBase in ( Select b.UID_DialogTable from DialogTable b with (readpast) where b.TableName
54 = @TableName and b.TableType = 'B' )  and v.IsDeactivatedByPreProcessor = 0 order by 1 select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while
55 @ElementIndex <= @ElementCount begin select top 1 @TablenameWork = bu.Ident1  , @IsAssgnmentWithEvent = bu.Bit1  , @IsCreatePendingChange = bu.Int1  ,
56 @zeile = TRIM(str(@ElementIndex)) from @ElementBuffer bu where bu.ElementIndex = @ElementIndex if @IsAssgnmentWithEvent = 1  begin  select @erg = @erg
57 + N'
58			-- Table: ' + @TablenameWork + '   ( events = ' + str(@IsAssgnmentWithEvent) + ')
59			declare @EntriesToFire_XOriginWEvent' + @zeile + ' QBM_YParameterList
60			insert into @EntriesToFire_XOriginWEvent'
61 + @zeile + '(Parameter1)
62				select x.XObjectKey
63				from deleted d join ' + @TableName + ' x on d.XObjectKey = x.XObjectKey
64				where x.XOrigin = 0
65				 and d.XOrigin  > 0 
66				 '
67 + case @IsCreatePendingChange when 1 then '' else '--' end + 'and d.XOrigin & ' + @StringPatternDirect + ' = 0 
68				 ' + case when @TableName = @TablenameWork
69 then '-- kein XObjectkey-Vergleich nötig' else 'and x.XObjectKey like ''<Key><T>' + @TablenameWork + '</T>%''' end + '
70				 and d.XMarkedForDeletion & '
71 + @StringPatternOutStanding + ' = 0 
72	' if @IsCreatePendingChange = 1 begin  select @erg = @erg + '
73			if @@rowcount > 0
74			 begin
75				exec QBM_PJobCreate_HOFireEvent_L '''
76 + @TablenameWork + ''', @EntriesToFire_XOriginWEvent' + @zeile + '
77						, @EventName = ''Remove''
78						, @GenProcID = @GenProcID
79						, @AdditionalObjectKeysAffected = @AdditionalEntries
80						, @ConnectionVariables = ''XORIGINEMPTY''

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

creates object-layer jobs via QBM_PJobCreate* fires object-layer event via HOFireEvent

Summary: calls QBM_PJobCreate_HOFireEvent_L, QBM_PJobCreate_HODelete_L, QBM_PJobCreate_SQLDel_L; writes INSERT into; reads/joins DialogTable, deleted, QBM_VQBMRelation, DialogColumn

Declared parameters

ParameterTypeDirection
nvarcharOUTPUT
@TableNamevarchar(30)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: @TableName @IsAssgnmentWithEvent @erg @pre @IsCreatePendingChange @TablenameWork @ElementBuffer @ElementCount @ElementIndex @zeile @PatternDelay0 @PatternDelay1 @StringPatternOutStanding @StringPatternDirect @isMNTable @IsMAllTable @AdditionalEntries @ROWCOUNT @EntriesToFire_XOriginWEvent @rowcount @EventName @GenProcID @AdditionalObjectKeysAffected @ConnectionVariables @isToFreezeOnError @WhereClauseAdditional @Tablename @Xdate @XUser @EntriesToFire_Out @EntriesToFire_OutO

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_PTriggerWatchCreateSQL expression dependencydbo · OBJECT_OR_COLUMN