dbo.QBM_FSQXMarkedForDeletionChg

SQL_SCALAR_FUNCTION

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

Open formatted source/search result

Parameters

NameTypeOutput
nvarcharyes
@ParentTablevarcharno
@operationvarcharno

Referenced objects

SchemaObjectColumn/minorClass
DialogColumnOBJECT_OR_COLUMN
DialogTableOBJECT_OR_COLUMN
DPRNameSpaceHasDialogTableOBJECT_OR_COLUMN
QBM_VQBMRelationALLOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
QBM_YParameterListTYPE
QBMDBQueueTaskOBJECT_OR_COLUMN
QBMModuleDependCollectionOBJECT_OR_COLUMN
dboQBM_FCVBinaryToStringOBJECT_OR_COLUMN
dboQBM_FCVGUIDToModuleOwnerOBJECT_OR_COLUMN
dboQBM_FGIBitPatternXMarkedForDelOBJECT_OR_COLUMN
dboQBM_FGIColumnExistsOBJECT_OR_COLUMN
dboQBM_FGIColumnExistsInSchemaOBJECT_OR_COLUMN
dboQBM_FSQTableJoinOBJECT_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_FSQXMarkedForDeletionChg (@ParentTable varchar(30) , @operation varchar(16) ) returns nvarchar(max) as begin declare
2 @Pattern varchar(64) = dbo.QBM_FCVBinaryToString( CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|OutStanding|', 0)), 0) , @Pattern_nurO
3 varchar(64) = dbo.QBM_FCVBinaryToString( CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|', 0)), 0) , @Pattern_nurO_inv varchar(64
4) = dbo.QBM_FCVBinaryToString( CONVERT(varbinary, dbo.QBM_FGIBitPatternXMarkedForDel('|OutStanding|', 1)), 0) declare @UID_DialogTable varchar(38) declare
5 @PKColumnName varchar(30) declare @CountPK int declare @ElementBuffer QBM_YCursorBuffer declare @TSTables QBM_YParameterList  declare @erg nvarchar(max
6) = ''  declare @UID_TaskNormal varchar(38) = 'QBM-K-XMarkedForDeletionPush' select top 1 @UID_DialogTable = t.UID_DialogTable , @PKColumnName = t.PKName1
7 , @CountPK = case when t.PKName2 > ' ' then 2 else 1 end from DialogTable t with (readpast) where t.TableName = @ParentTable select top 1 @UID_TaskNormal
8 = ta.UID_Task from DialogTable t with (readpast) join QBMDBQueueTask ta with (readpast) on ta.UID_Task = left(t.UID_DialogTable, 3) + '-K-XMarkedForDeletionPush'
9 where t.TableName = @ParentTable if @operation in ('Insert', 'Delete') begin goto EndLabel end if dbo.QBM_FGIColumnExists(@ParentTable, 'XMarkedForDeletion'
10) = 1 begin if dbo.QBM_FGIColumnExists(@ParentTable, 'XDateSubItem') = 1 begin select @erg = concat('
11			declare @DBQueueElements_XMarkedForDel QBM_YDBQueueRaw
12	
13			insert into @DBQueueElements_XMarkedForDel (object, subobject, genprocid)
14			select x.uid, '''
15 , @UID_DialogTable , ''',   @GenProcID
16			from ( 			
17					select i.' , @PKColumnName , ' as uid
18	   				from ' , @ParentTable , ' i join deleted d on '
19 , dbo.QBM_FSQTableJoin(@ParentTable, 'd', 'i') , '
20						where (d.XMarkedForDeletion & ' , @Pattern , ')
21						  <>  (i.XMarkedForDeletion & ' , @Pattern
22 , ')
23				) as x 
24
25			exec QBM_PDBQueueInsert_Bulk ''', @UID_TaskNormal , ''' , @DBQueueElements_XMarkedForDel 
26		' )  end     if exists (select top
27 1 1 from sys.tables v with (readpast) where v.name = 'DPRNameSpaceHasDialogTable' )  and exists (select top 1 1 from QBM_VQBMRelationALL a join DialogTable
28 tc with (readpast) on a.UID_DialogTableChild = tc.UID_DialogTable join DialogColumn cc with (readpast) on tc.UID_DialogTable = cc.UID_DialogTable and 
29cc.ColumnName = 'XMarkedForDeletion' where a.ParentTable = @ParentTable and a.IsForUpdateXDateSubItem = 0 and ( tc.IsMAllTable = 1  or tc.isMNTable = 1
30 ) ) begin insert into @TSTables(Parameter1) select distinct t.TableName from DPRNameSpaceHasDialogTable nht with (readpast) join DialogTable t with (readpast
31) on nht.UID_DialogTable = t.UID_DialogTable insert into @ElementBuffer (Ident1, Ident2, Ident3) select a.ParentColumn, a.ChildTable, a.ChildColumn from
32 QBM_VQBMRelationALL a join DialogTable tc with (readpast) on a.UID_DialogTableChild = tc.UID_DialogTable join DialogColumn cc with (readpast) on tc.UID_DialogTable
33 = cc.UID_DialogTable and cc.ColumnName = 'XMarkedForDeletion' join @TSTables etp on etp.parameter1 = @ParentTable join @TSTables etc on etc.Parameter1
34 = a.ChildTable where a.ParentTable = @ParentTable and a.IsForUpdateXDateSubItem = 0 and ( tc.IsMAllTable = 1  or tc.isMNTable = 1 ) and dbo.QBM_FCVGUIDToModuleOwner
35(a.UID_DialogTableParent) = dbo.QBM_FCVGUIDToModuleOwner(a.UID_DialogTableChild)  and (exists (select top 1 1 from QBMModuleDependCollection co with (readpast
36) where left(co.UID_ModulePredecessor, 3) = 'TSB' and left(co.UID_ModuleFollower, 3) = left(dbo.QBM_FCVGUIDToModuleOwner(a.UID_DialogTableChild), 3) ) 
37 or dbo.QBM_FCVGUIDToModuleOwner(a.UID_DialogTableChild) = 'UCI' ) and tc.UsageType = 'UserData' if @@ROWCOUNT > 0  begin select @erg = @erg + string_agg
38( convert(nvarchar(max), concat('
39				update ' , bu.Ident2  , '
40						set XMarkedForDeletion = (e.XMarkedForDeletion & ' , @Pattern_nurO_inv , ')
41												 | (l.XMarkedForDeletion  & '
42 , @Pattern_nurO , ')
43												 ', case when dbo.QBM_FGIColumnExistsInSchema(bu.Ident2 , 'XDateUpdated' ) = 1 then ' , XDateUpdated = @XDate, XUserUpdated = @XUser'
44 else '' end, '
45					from ' , bu.Ident2  , ' e join deleted d on e.' , bu.Ident3  , ' = d.' , bu.Ident1 , '
46											join ' + @ParentTable + ' l on d.XObjectKey = l.XObjectKey
47						where (d.XMarkedForDeletion ^ l.XMarkedForDeletion ) & '
48 + @Pattern_nurO + ' > 0
49						' )  )  , '' )  from @ElementBuffer bu end end   if @erg > ' ' begin select @erg = '	
50	if update(XMarkedForDeletion)
51		begin
52		if exists (select top 1 1
53				from deleted d join '
54 + @ParentTable + ' l on d.XObjectKey = l.XObjectKey
55				where (d.XMarkedForDeletion ^ l.XMarkedForDeletion ) & ' + @Pattern + ' > 0
56				)
57		begin
58'
59 + @erg + '
60
61			end
62		end' end  end  endLabel: return(@erg) end 
63

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

inserts DBQueue tasks

Summary: calls QBM_PDBQueueInsert_Bulk; writes INSERT into; reads/joins DialogTable, QBMDBQueueTask, deleted, sys, QBM_VQBMRelationALL…

Declared parameters

ParameterTypeDirection
nvarcharOUTPUT
@ParentTablevarchar(30)input
@operationvarchar(16)input

DML targets

INSERT into

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

QBM-K-XMarkedForDeletionPush

Temp tables / referenced variables

Temp: None extracted.

Variables: @ParentTable @operation @Pattern @Pattern_nurO @Pattern_nurO_inv @UID_DialogTable @PKColumnName @CountPK @ElementBuffer @TSTables @erg @UID_TaskNormal @DBQueueElements_XMarkedForDel @GenProcID @ROWCOUNT @XDate @XUser

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