dbo.QBM_FSQTriggerWatchTable

SQL_SCALAR_FUNCTION

Created 2025-12-15T17:40:51.870 · modified 2026-04-14T23:20:26.767 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
nvarcharyes
@TableNamenvarcharno
@Operationnvarcharno

Referenced objects

SchemaObjectColumn/minorClass
DialogColumnOBJECT_OR_COLUMN
DialogTableOBJECT_OR_COLUMN
QBM_YSingleGUIDTYPE
dboQBM_FCVStringToIndentOBJECT_OR_COLUMN
dboQBM_FSQTriggerWatchColumnOBJECT_OR_COLUMN
dboQBM_FSQTriggerWatchDisplayOBJECT_OR_COLUMN
dboQBM_FTColumnsToWatchOBJECT_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_FSQTriggerWatchTable (@TableName nvarchar(64) , @Operation nvarchar(16) ) returns nvarchar(max) as begin declare
2 @erg nvarchar(max) = N'' declare @ergTmp nvarchar(max) = N''  declare @Tables QBM_YSingleGUID  declare @CurrentTable varchar(30) declare @DebugSwitch 
3int = 0  declare @UmLadenTempEcht nvarchar(max) = '
4 
5	insert into @DialogWatchOperation (ObjectKeyOfRow, DisplayValue, UID_DialogWatchOperation)
6		select x.ObjectKeyOfRow, x.DisplayValue, NEWID()
7			from (
8				select distinct ObjectkeyOfRow , DisplayValue
9				from @DialogWatchProperty
10				) as x
11
12	insert into DialogWatchProperty (UID_DialogWatchProperty,UID_DialogWatchOperation, UID_DialogColumn, ContentShort, HasContentFull, ContentFull)
13			select newid(), o.UID_DialogWatchOperation, p.UID_DialogColumn, p.ContentShort, p.HasContentFull, p.ContentFull
14				from @DialogWatchOperation o join @DialogWatchProperty p on o.ObjectkeyOfRow = p.ObjectkeyOfRow
15
16	insert into DialogWatchOperation ( UID_DialogWatchOperation , GenProcID ,OperationType,  OperationDate, OperationUser, ObjectKeyOfRow , OperationLevel, DisplayValue )
17		select t.UID_DialogWatchOperation , @GenProcID , ''%OperationType%'',  GetUTCDate(), @ActionUser, t.ObjectKeyOfRow , @OperationLevel, t.DisplayValue
18			from @DialogWatchOperation t
19
20'
21 declare @XOriginHandling bit = 0 if @operation in ('insert') begin insert into @Tables(UID_SingleGuid ) select distinct TableNameView from dbo.QBM_FTColumnsToWatch
22(@TableName , @Operation) while exists(select top 1 1 from @Tables ) begin select top 1 @CurrentTable = t.UID_SingleGuid  from @Tables t if @erg > ' ' 
23begin select @erg = concat(@erg , '
24				union all' ) end select @erg = concat(@erg , '			
25			select newid() , @GenProcID , ''' , upper(substring(@operation
26,1,1)) , N''',  GetUTCDate(), @ActionUser, t.XObjectKey , @OperationLevel, ' )  select @erg = concat(@erg , dbo.QBM_FSQTriggerWatchDisplay(@TableName ,
27 N't') ) select @erg = concat(@erg , N'
28			from inserted t' ) if @CurrentTable <> @TableName  begin select @erg = concat(@erg , '
29			where t.XObjectKey like ''<Key><T>'
30 , @CurrentTable , '</T>%''' ) end delete  @Tables  where UID_SingleGuid  = @CurrentTable end  if @erg > ' ' begin select @erg = concat(N'
31	 insert into DialogWatchOperation ( UID_DialogWatchOperation , GenProcID ,OperationType,  OperationDate, OperationUser, ObjectKeyOfRow , OperationLevel, DisplayValue )
32'
33 , @erg ) end  goto endLabel end  if exists (select top 1 1 from DialogTable t with (readpast) join DialogColumn c with (readpast) on t.UID_DialogTable
34 = c.UID_DialogTable where t.TableName = @TableName and c.ColumnName = 'XOrigin' ) begin select @XOriginHandling = 1 end if @operation = 'update' begin
35 select @ergTmp = dbo.QBM_FSQTriggerWatchColumn(@TableName, @operation) if @ergTmp > ' ' begin select @erg = concat(@ergTmp , REPLACE(@UmLadenTempEcht,
36'%OperationType%', 'U' )) end if @XOriginHandling = 1 begin select @ergTmp = dbo.QBM_FSQTriggerWatchColumn(@TableName, 'UpdateDelete') if @ergTmp > ' '
37 begin select @erg = concat(@erg , '	-- Delete handling XOrigin
38	if update(XOrigin)
39	 begin
40
41		declare @XOriginWatchOperation QBM_YWatchBufferOp
42		declare @XOriginWatchProperty QBM_YWatchBufferProp
43'
44 ,  replace(REPLACE(@ergTmp , '@DialogWatchOperation' , '@XOriginWatchOperation') , '@DialogWatchProperty' , '@XOriginWatchProperty')  , '
45
46' ,  replace
47(REPLACE(dbo.QBM_FCVStringToIndent(REPLACE(@UmLadenTempEcht,'%OperationType%', 'D' ), 1) , '@DialogWatchOperation' , '@XOriginWatchOperation') , '@DialogWatchProperty'
48 , '@XOriginWatchProperty')  , '
49
50	 end -- if update(XOrigin)
51	 -- / Delete handling XOrigin' ) end  end  if @DebugSwitch > 0 begin select @erg = concat
52(@erg , ' -- ## DeleteHandling XOrigin im Update') end goto EndLabel end  if @operation = 'delete' begin if @XOriginHandling = 0 begin select @ergTmp =
53 dbo.QBM_FSQTriggerWatchColumn(@TableName, @operation) if @ergTmp > ' ' begin select @erg = concat(@ergTmp , REPLACE(@UmLadenTempEcht,'%OperationType%'
54, 'D' )) end end else begin if @DebugSwitch > 0 begin select @erg = concat(@erg , ' -- ## DeleteHandling XOrigin im delete: leer' ) end end goto EndLabel
55 end  endLabel: return(@erg) end 
56

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

None extracted.

Summary: writes INSERT into, INSERT DialogWatchProperty, INSERT DialogWatchOperation; reads/joins QBM_FTColumnsToWatch, inserted, DialogTable, DialogColumn

Declared parameters

ParameterTypeDirection
nvarcharOUTPUT
@TableNamenvarchar(64)input
@Operationnvarchar(16)input

DML targets

INSERT into INSERT DialogWatchProperty INSERT DialogWatchOperation

Called routines

None extracted.

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @TableName @Operation @erg @ergTmp @Tables @CurrentTable @DebugSwitch @UmLadenTempEcht @DialogWatchOperation @DialogWatchProperty @GenProcID @ActionUser @OperationLevel @XOriginHandling @operation @XOriginWatchOperation @XOriginWatchProperty

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