dbo.QER_TUOrgRoot

SQL_TRIGGER parent OrgRoot

Created 2025-06-27T18:01:08.120 · modified 2026-04-14T23:23:08.420 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
No parameters.

Referenced objects

SchemaObjectColumn/minorClass
BaseTreeOBJECT_OR_COLUMN
deletedOBJECT_OR_COLUMN
insertedOBJECT_OR_COLUMN
OrgRootOBJECT_OR_COLUMN
PersonInBaseTreeOBJECT_OR_COLUMN
QBM_PDBQueueInsert_bulkOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_YDBQueueRawTYPE
dboQBM_FGISessionContextOBJECT_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   trigger QER_TUOrgRoot on OrgRoot  for UPDATE not for Replication as begin  BEGIN TRY if exists (select top 1 1 from inserted) goto start
2 if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if exists
3 (select top 1 1 from OrgRoot r join deleted d on r.UID_OrgRoot = d.UID_OrgRoot where d.IsTopDown <> r.IsTopDown and d.UID_OrgRoot like '___-V-%' ) begin
4 raiserror( '#LDS#Direction of inheritance cannot be changed, because it''s a default role.|', 18, 2) with nowait end  if update (IsPersonAssignOnce) begin
5 if exists (select top 1 1 from OrgRoot r join deleted d on r.UID_OrgRoot = d.UID_OrgRoot where r.IsPersonAssignOnce = 1 and d.UID_OrgRoot like '___-V-%'
6 ) begin raiserror( '#LDS#IsPersonAssignOnce cannot be set, because it''s a default role.|', 18, 2) with nowait end end if update (IsPersonAssignOnce) 
7begin if exists (select top 1 1 from OrgRoot r join deleted d on r.UID_OrgRoot = d.UID_OrgRoot where r.IsPersonAssignOnce = 1 and exists (select top 1 
81 from PersonInBaseTree pib join BaseTree b on pib.UID_Org = b.UID_Org and b.UID_OrgRoot = r.UID_OrgRoot group by pib.UID_Person having count(*) > 1 ) 
9) begin raiserror( '#LDS#IsPersonAssignOnce cannot be set, because at least one person is assigned more than once.|', 18, 2) with nowait end end  declare
10 @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from (select r.UID_OrgRoot
11 as uid from OrgRoot r join deleted d on r.UID_OrgRoot = d.UID_OrgRoot where d.IsTopDown <> r.IsTopDown and d.UID_OrgRoot not like '___-V-%' ) as x exec
12 QBM_PDBQueueInsert_bulk 'QER-K-OrgROOT', @DBQueueElements_01 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END
13 CATCH ende: return end 
14

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

inserts DBQueue tasks uses session context values has TRY/CATCH error handling

Summary: calls QBM_PDBQueueInsert_bulk, QBM_PSessionErrorAdd; writes INSERT into, UPDATE not; reads/joins inserted, deleted, OrgRoot, PersonInBaseTree, BaseTree

Declared parameters

No declared parameters in sys.parameters for this object, or metadata was not available.

DML targets

INSERT into UPDATE not

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

QER-K-OrgROOT

Temp tables / referenced variables

Temp: #LDS #Direction #IsPersonAssignOnce

Variables: @GenProcID @DBQueueElements_01

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.