dbo.QER_TIPersonInBaseTree

SQL_TRIGGER parent PersonInBaseTree

Created 2025-06-27T18:01:08.317 · modified 2026-04-14T23:23:08.450 · 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
BaseTreeExcludesBasetreeOBJECT_OR_COLUMN
DynamicGroupOBJECT_OR_COLUMN
insertedOBJECT_OR_COLUMN
OrgRootOBJECT_OR_COLUMN
OrgtypeOBJECT_OR_COLUMN
PersonInBaseTreeOBJECT_OR_COLUMN
QBM_PDBQueueInsert_BulkOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_YDBQueueRawTYPE
QBM_YparameterListTYPE
QER_PAssignmentCheckValidOBJECT_OR_COLUMN
dboQBM_FGIBitPatternXOriginOBJECT_OR_COLUMN
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

1     create   trigger QER_TIPersonInBaseTree on PersonInBaseTree  for Insert not for Replication as begin  declare @QBM_BitPatternXOrigin_Direct
2 int = dbo.QBM_FGIBitPatternXOrigin('|Direct|', 0)  BEGIN TRY if exists (select top 1 1 from inserted) goto start return start: declare @GenProcID varchar
3(38) select @GenProcID = dbo.QBM_FGISessionContext('')   declare @AssignCheckValues QBM_YparameterList insert into @AssignCheckValues(Parameter1, Parameter2
4) select i.UID_Org, i.XOrigin from inserted i exec QER_PAssignmentCheckValid 'QER-AsgnBT-Person', @AssignCheckValues, @GenProcID if exists (select top 
51 1 from inserted i where isnull(i.uid_org, '') = '' ) begin  raiserror( '#LDS#Empty values not permitted.|', 18, 1) with nowait end if exists (select 
6top 1 1 from BaseTreeExcludesBasetree ) begin  if exists (select top 1 1 from inserted i join PersonInBaseTree pio  on i.uid_person = pio.uid_person and
7 pio.XOrigin > 0  join BaseTreeExcludesBaseTree beb on pio.uid_org = beb.uid_org and beb.uid_OrgExcluded = i.uid_org  join BaseTree bex on beb.UID_OrgExcluded
8 = bex.UID_Org left outer join DynamicGroup g on g.ObjectKeyBaseTree = bex.XObjectKey where g.UID_DynamicGroup is null )  or exists (select top 1 1 from
9 inserted i join PersonInBaseTree pio  on i.uid_person = pio.uid_person and pio.XOrigin > 0  join BaseTreeExcludesBaseTree beb on pio.uid_org = beb.uid_orgExcluded
10 and beb.uid_Org = i.uid_org  join BaseTree bex on beb.UID_OrgExcluded = bex.UID_Org left outer join DynamicGroup g on g.ObjectKeyBaseTree = bex.XObjectKey
11 where g.UID_DynamicGroup is null ) begin  raiserror( '#LDS#Cannot make assignment because there are already identity assignments to roles that exclude the role(s) to be added.|'
12, 18, 2) with nowait end end   if exists (select top 1 1 from inserted i join BaseTree n on i.UID_Org = n.UID_Org and i.XOrigin & @QBM_BitPatternXOrigin_Direct
13 = 1 join OrgRoot r on n.UID_OrgRoot = r.UID_OrgRoot and r.IsPersonAssignOnce = 1 join PersonInBaseTree pib on i.UID_Person = pib.UID_Person join BaseTree
14 o on pib.UID_Org = o.UID_Org and o.UID_OrgRoot = r.UID_OrgRoot group by pib.uid_person having count(*) > 1 ) begin raiserror( '#LDS#Cannot make direct assignment because there are already assignments of this person to roles in this role class with IsPersonAssignOnce.|'
15, 18, 2) with nowait end if exists (select top 1 1 from inserted i join BaseTree n on i.UID_Org = n.UID_Org and i.XOrigin & @QBM_BitPatternXOrigin_Direct
16 = 1 join OrgRoot rn on n.UID_OrgRoot = rn.UID_OrgRoot join Orgtype t on rn.UID_OrgType = t.UID_OrgType and t.IsPersonAssignOnce = 1 join PersonInBaseTree
17 pib on i.UID_Person = pib.UID_Person join BaseTree o on pib.UID_Org = o.UID_Org join OrgRoot ro on o.UID_OrgRoot = ro.UID_OrgRoot and ro.UID_OrgType =
18 t.UID_OrgType group by pib.uid_person having count(*) > 1 ) begin raiserror( '#LDS#Cannot make direct assignment because there are already assignments of this person to roles in a role class in this role type with IsPersonAssignOnce.|'
19, 18, 2) with nowait end if exists (select top 1 1 from inserted i join BaseTree n on i.UID_Org = n.UID_Org and i.XOrigin & @QBM_BitPatternXOrigin_Direct
20 = 1 join Orgtype t on n.UID_OrgType = t.UID_OrgType and t.IsPersonAssignOnce = 1 join PersonInBaseTree pib on i.UID_Person = pib.UID_Person join BaseTree
21 o on pib.UID_Org = o.UID_Org and o.UID_OrgType = t.UID_OrgType group by pib.uid_person having count(*) > 1 ) begin raiserror( '#LDS#Cannot make direct assignment because there are already assignments of this person to roles in this role type with IsPersonAssignOnce.|'
22, 18, 2) with nowait end  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid_parameter
23, x.uid_SubParameter, @GenProcID from ( select m.uid_person as uid_parameter, m.uid_org as uid_subparameter from inserted m ) as x exec QBM_PDBQueueInsert_Bulk
24 'QER-K-AllForPersonInBaseTree', @DBQueueElements_01 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH 
25ende: return end 
26

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

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

Summary: calls QER_PAssignmentCheckValid, QBM_PDBQueueInsert_Bulk, QBM_PSessionErrorAdd; writes INSERT not, INSERT into; reads/joins inserted, BaseTreeExcludesBasetree, PersonInBaseTree, BaseTreeExcludesBaseTree, BaseTree…

Declared parameters

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

DML targets

INSERT not INSERT into

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

QER-K-AllForPersonInBaseTree

Temp tables / referenced variables

Temp: #LDS #Empty #Cannot

Variables: @QBM_BitPatternXOrigin_Direct @GenProcID @AssignCheckValues @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.