dbo.QBM_TUAssembly_QBMRelation
SQL_TRIGGER parent QBMRelation
Created 2025-06-27T18:01:01.820 · modified 2026-04-14T23:23:08.633 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
| No parameters. | ||
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| deleted | OBJECT_OR_COLUMN | ||
| DialogColumn | OBJECT_OR_COLUMN | ||
| DialogTable | OBJECT_OR_COLUMN | ||
| inserted | OBJECT_OR_COLUMN | ||
| QBM_PDBQueueInsert_Bulk | OBJECT_OR_COLUMN | ||
| QBM_PDBQueueInsert_Single | OBJECT_OR_COLUMN | ||
| QBM_PSessionErrorAdd | OBJECT_OR_COLUMN | ||
| QBM_YDBQueueRaw | TYPE | ||
| QBMRelation | OBJECT_OR_COLUMN | ||
| dbo | QBM_FGISessionContext | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1 create trigger QBM_TUAssembly_QBMRelation on QBMRelation for Update not for Replication as begin declare @GenProcID varchar(38) = dbo.QBM_FGISessionContext 2('') declare @XUser nvarchar(64) = object_name(@@procid) declare @Xdate datetime = getutcdate() BEGIN TRY if exists (select top 1 1 from inserted) goto 3 start if exists (select top 1 1 from deleted) goto start return start: if update(ParentRestriction) or update(ChildRestriction) or update(ParentExecuteBy 4) or update(ChildExecuteBy) begin exec QBM_PDBQueueInsert_Single 'QBM-K-ScriptAssemblyReset', 'TypedWrappers', '#', @GenProcID end if UPDATE(ismnrelation 5) begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from 6 (select t.TableName as UID from QBMRelation i join deleted d on i.UID_QBMRelation = d.UID_QBMRelation join DialogColumn c on i.UID_ChildColumn = c.UID_DialogColumn 7 join DialogTable t on c.UID_DialogTable = t.UID_DialogTable where isnull(i.ismnRelation,0) <> isnull(d.ismnRelation,0) and i.ParentExecuteBy in ('T', 8 'D') union select t.TableName as UID from QBMRelation i join deleted d on i.UID_QBMRelation = d.UID_QBMRelation join DialogColumn c on i.UID_ParentColumn 9 = c.UID_DialogColumn join DialogTable t on c.UID_DialogTable = t.UID_DialogTable where isnull(i.ismnRelation,0) <> isnull(d.ismnRelation,0) and i.ParentExecuteBy 10 in ('T', 'D') ) as x exec QBM_PDBQueueInsert_Bulk 'QBM-K-CommonMakeWatchtrigger', @DBQueueElements_01 end if UPDATE(ParentRestriction) or UPDATE(ParentExecuteBy 11) or UPDATE(ChildRestriction) or UPDATE(ChildExecuteBy) or UPDATE(IsForUpdateXDateSubItem) begin declare @DBQueueElements_02 QBM_YDBQueueRaw insert into 12 @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select t.TableName as UID from deleted i join QBMRelation r on 13 i.UID_QBMRelation = r.UID_QBMRelation join DialogColumn c on i.UID_ParentColumn = c.UID_DialogColumn join DialogTable t on c.UID_DialogTable = t.UID_DialogTable 14 where (r.ParentRestriction <> i.ParentRestriction or r.ParentExecuteBy <> i.ParentExecuteBy or r.ChildRestriction <> i.ChildRestriction or r.ChildExecuteBy 15 <> i.ChildExecuteBy or r.IsForUpdateXDateSubItem <> i.IsForUpdateXDateSubItem ) and r.ParentExecuteBy in ('T', 'D') union select t.TableName as UID from 16 deleted i join QBMRelation r on i.UID_QBMRelation = r.UID_QBMRelation join DialogColumn c on i.UID_ChildColumn = c.UID_DialogColumn join DialogTable t 17 on c.UID_DialogTable = t.UID_DialogTable where (r.ParentRestriction <> i.ParentRestriction or r.ParentExecuteBy <> i.ParentExecuteBy or r.ChildRestriction 18 <> i.ChildRestriction or r.ChildExecuteBy <> i.ChildExecuteBy or r.IsForUpdateXDateSubItem <> i.IsForUpdateXDateSubItem ) and r.ParentExecuteBy in ('T' 19, 'D') ) as x exec QBM_PDBQueueInsert_Bulk 'QBM-K-CommonMakeWatchtrigger', @DBQueueElements_02 end if update(ParentRestriction) or update(ParentExecuteBy 20) or update(ChildRestriction) or update(ChildExecuteBy) or update(ParentAllowUpdate) begin if exists (select top 1 1 from QBMRelation r join deleted 21d on r.UID_QBMRelation = d.UID_QBMRelation where (isnull(r.ParentRestriction, '') <> isnull(d.ParentRestriction, '') or isnull(r.ParentExecuteBy, '') <> 22 isnull(d.ParentExecuteBy, '') or isnull(r.ChildRestriction, '') <> isnull(d.ChildRestriction, '') or isnull(r.ChildExecuteBy, '') <> isnull(d.ChildExecuteBy 23, '') ) ) begin update QBMRelation set ParentExecuteBy = case v.ParentExecuteBy when 'N' then 'N' else 'T' end , ParentAllowUpdate = 0 , ParentRestriction 24 = b.ParentRestriction , XDateUpdated = @Xdate , XUserUpdated = @XUser from QBMRelation v join inserted b on v.UID_QBMRelationBase = b.UID_QBMRelation 25 where b.ParentExecuteBy = 'T' and ( v.ParentExecuteBy not in ('T', 'N') or v.ParentAllowUpdate = 1 or v.ParentRestriction <> b.ParentRestriction ) update 26 QBMRelation set ParentExecuteBy = case v.ParentExecuteBy when 'N' then 'N' else 'D' end , ParentAllowUpdate = b.ParentAllowUpdate , ParentRestriction 27= case b.ParentAllowUpdate when 1 then v.ParentRestriction else b.ParentRestriction end , XDateUpdated = @Xdate , XUserUpdated = @XUser from QBMRelation 28 v join inserted b on v.UID_QBMRelationBase = b.UID_QBMRelation where b.ParentExecuteBy = 'D' and ( v.ParentExecuteBy not in ('D', 'N') or v.ParentAllowUpdate 29 <> b.ParentAllowUpdate or ( b.ParentAllowUpdate = 0 and b.ParentRestriction <> v.ParentRestriction ) ) end exec QBM_PDBQueueInsert_Single 'QBM-K-CommonMakeRITriggerPre' 30, '', '', @GenProcID end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 31
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.633
inserts DBQueue tasks uses session context values has TRY/CATCH error handling
Summary: calls QBM_PDBQueueInsert_Single, QBM_PDBQueueInsert_Bulk, QBM_PSessionErrorAdd; writes INSERT into, UPDATE not, UPDATE QBMRelation; reads/joins inserted, deleted, QBMRelation, DialogColumn, DialogTable
Declared parameters
No declared parameters in sys.parameters for this object, or metadata was not available.
DML targets
INSERT into UPDATE not UPDATE QBMRelationRead/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: None extracted.
DBQueue/tasks
QBM-K-ScriptAssemblyReset QBM-K-CommonMakeWatchtrigger QBM-K-CommonMakeRITriggerPreTemp tables / referenced variables
Temp: None extracted.
Variables: @GenProcID @XUser @procid @Xdate @DBQueueElements_01 @DBQueueElements_02
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.