dbo.QBM_FTColumnsToWatch

SQL_TABLE_VALUED_FUNCTION

Created 2026-04-14T23:20:26.730 · modified 2026-04-14T23:20:26.730 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
@TableNamevarcharno
@Operationvarcharno

Referenced objects

SchemaObjectColumn/minorClass
DialogColumnOBJECT_OR_COLUMN
DialogTableOBJECT_OR_COLUMN
dboQBM_FGIConfigparmValueOBJECT_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

1create function dbo.QBM_FTColumnsToWatch(@TableName varchar(32) , @Operation varchar(16) ) returns @erg table ( TableName nvarchar(32) collate database_default
2 , ColumnName nvarchar(32) collate database_default , TableNameView nvarchar(32) collate database_default , ColumnNameView nvarchar(32) collate database_default
3 ) as begin declare @UeberhauptWas int = 0 if '' = dbo.QBM_FGIConfigparmValue('Common\ProcessState\PropertyLog') begin goto ende end if not exists (select
4 top 1 1 from DialogColumn c with (readpast) join DialogTable t with (readpast) on c.UID_DialogTable = t.UID_DialogTable where t.TableName = @TableName
5 and c.ColumnName = 'XObjectKey' ) begin goto ende end   insert into @erg (TableName, ColumnName, TableNameView, ColumnNameView) select bt.TableName, bc.ColumnName
6, t.TableName, c.ColumnName from DialogColumn bc with (readpast) join DialogTable bt with (readpast) on bc.UID_DialogTable = bt.UID_DialogTable and bt.TableName
7 = @TableName and bc.IsDeactivatedByPreProcessor = 0 and bt.IsDeactivatedByPreProcessor = 0 join DialogTable t with (readpast) on ( t.TableType = 'T' and
8 t.UID_DialogTable = bt.UID_DialogTable or t.TableType = 'V' and t.UID_DialogTableBase = bt.UID_DialogTable ) and t.IsDeactivatedByPreProcessor = 0 join
9 DialogColumn c with (readpast) on c.UID_DialogTable = t.UID_DialogTable and ( t.TableType = 'T' and c.ColumnName = bc.ColumnName or t.TableType = 'V' 
10and c.UID_BaseColumn = bc.UID_DialogColumn ) and c.IsDeactivatedByPreProcessor = 0 where ( (c.IsToWatch = 1 and @Operation in ('INSERT', 'UPDATE') and 
11t.UsageType in ('CONFIGURATION', 'USERDATA', 'MATERIAL') ) or (c.IsToWatchDelete = 1 and @Operation in ('DELETE') and ( t.UsageType in ('CONFIGURATION'
12, 'USERDATA', 'MATERIAL') or ( t.UsageType = 'HISTORY'  and left(t.UID_DialogTable, 3) <> 'QBM' ) ) ) ) select @UeberhauptWas = @@ROWCOUNT if @UeberhauptWas
13 > 0 begin insert into @erg (TableName, ColumnName, TableNameView, ColumnNameView) select bt.TableName, bc.ColumnName, t.TableName, c.ColumnName from DialogColumn
14 bc with (readpast) join DialogTable bt with (readpast) on bc.UID_DialogTable = bt.UID_DialogTable and bt.TableName = @TableName join DialogTable t with
15 (readpast) on ( t.TableType = 'T' and t.UID_DialogTable = bt.UID_DialogTable or t.TableType = 'V' and t.UID_DialogTableBase = bt.UID_DialogTable ) join
16 DialogColumn c with (readpast) on c.UID_DialogTable = t.UID_DialogTable and ( t.TableType = 'T' and c.ColumnName = bc.ColumnName or t.TableType = 'V' 
17and c.UID_BaseColumn = bc.UID_DialogColumn ) where c.IsAlternatePKMember = 1 and t.IsTransportDisabled = 0 and ( left(t.UID_DialogTable, 3) = 'QBM' and
18 '1' = dbo.QBM_FGIConfigparmValue('Common\ProcessState\PropertyLog\AutoTrackAlternatePK') or left(t.UID_DialogTable, 3) <> 'QBM' and '1' = dbo.QBM_FGIConfigparmValue
19('Common\ProcessState\PropertyLog\AutoTrackAlternatePK\PayLoad') ) and Not exists (select top 1 1 from @erg e where e.ColumnName = c.ColumnName and e.TableName
20 = @TableName ) end  if @UeberhauptWas > 0 and @Operation = 'Delete' begin insert into @erg (TableName, ColumnName, TableNameView, ColumnNameView) select
21 bt.TableName, bc.ColumnName, t.TableName, c.ColumnName from DialogColumn bc with (readpast) join DialogTable bt with (readpast) on bc.UID_DialogTable 
22= bt.UID_DialogTable and bt.TableName = @TableName and bc.IsDeactivatedByPreProcessor = 0 and bt.IsDeactivatedByPreProcessor = 0 join DialogTable t with
23 (readpast) on ( t.TableType = 'T' and t.UID_DialogTable = bt.UID_DialogTable or t.TableType = 'V' and t.UID_DialogTableBase = bt.UID_DialogTable ) and
24 t.IsDeactivatedByPreProcessor = 0 join DialogColumn c with (readpast) on c.UID_DialogTable = t.UID_DialogTable and ( t.TableType = 'T' and c.ColumnName
25 = bc.ColumnName or t.TableType = 'V' and c.UID_BaseColumn = bc.UID_DialogColumn ) and c.IsDeactivatedByPreProcessor = 0 where c.IsPKMember = 1 and not
26 exists (Select top 1 1 from @erg e where e.TableName = bt.TableName and e.ColumnName = bc.ColumnName and e.TableNameView = t.TableName and e.ColumnNameView
27 = c.ColumnName ) end delete  @erg from @erg e where exists (select top 1 1 from DialogColumn cc with (readpast) join DialogTable t with (readpast) on 
28cc.UID_DialogTable = t.UID_DialogTable where e.TableName = t.TableName and e.ColumnName= cc.COLUMNNAME and cc.SchemaDataType in ('text', 'ntext', 'image'
29)  ) ende: return end 
30

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

None extracted.

Summary: writes INSERT into; reads/joins DialogColumn, DialogTable; uses config Common\ProcessState\PropertyLog, Common\ProcessState\PropertyLog\AutoTrackAlternatePK, Common\ProcessState\PropertyLog\AutoTrackAlternatePK\PayLoad

Declared parameters

ParameterTypeDirection
@TableNamevarchar(32)input
@Operationvarchar(16)input

DML targets

INSERT into

Called routines

None extracted.

Read/join references

Config/session

Config: Common\ProcessState\PropertyLog Common\ProcessState\PropertyLog\AutoTrackAlternatePK Common\ProcessState\PropertyLog\AutoTrackAlternatePK\PayLoad

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @TableName @Operation @erg @UeberhauptWas @ROWCOUNT

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_FSQTriggerWatchColumnSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_FSQTriggerWatchTableSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_PTriggerWatchCreateSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_FSQTriggerWatchColumnsource text referenceSQL_SCALAR_FUNCTION
dbo.QBM_FSQTriggerWatchTablesource text referenceSQL_SCALAR_FUNCTION
dbo.QBM_PTriggerWatchCreatesource text referenceuses session context values, has TRY/CATCH error handling