dbo.QER_FTOrgAttHighest

SQL_INLINE_TABLE_VALUED_FUNCTION

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

Open formatted source/search result

Parameters

NameTypeOutput
@uid_orgvarcharno
@uid_personinsertedvarcharno
@uid_personorderedvarcharno
@WithFallBackRootbitno
@IgnoreNoDecideForPersonbitno

Referenced objects

SchemaObjectColumn/minorClass
BaseTreeOBJECT_OR_COLUMN
BaseTreeCollectionOBJECT_OR_COLUMN
OrgRootOBJECT_OR_COLUMN
PersonInBaseTreeOBJECT_OR_COLUMN
PersonWantsOrgOBJECT_OR_COLUMN
QER_VPersonsAreMeOBJECT_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.QER_FTOrgAttHighest (@uid_org varchar(38) , @uid_personinserted varchar(38)  , @uid_personordered varchar(38) , @WithFallBackRoot bit
2  , @IgnoreNoDecideForPerson bit  ) returns table as return ( select pib.UID_Org, pib.UID_Person, pwo.UID_PersonWantsOrg as UID_PWORulerOrigin from ( select
3 top 1 z.UID_Org from (select b.treelevel + 1 as treelevel, b.UID_OrgAttestator as UID_Org from BaseTreeCollection co join BaseTree b on co.UID_Org = @uid_org
4 and co.UID_ParentOrg = b.UID_Org   union all select 0, r.UID_OrgAttestator as uid_org from OrgRoot r join BaseTree b on b.UID_OrgRoot = r.UID_OrgRoot 
5and b.UID_Org = @uid_org where @WithFallBackRoot = 1 ) as z join PersonInBaseTree pio on z.UID_Org = pio.UID_Org and pio.XOrigin > 0 left outer join QER_VPersonsAreMe
6 api on pio.UID_Person = api.UID_PersonAlsoMe and api.UID_PersonOrigin = case when @uid_personinserted > ' ' and @IgnoreNoDecideForPerson = 0 and dbo.QBM_FGIConfigparmValue
7('QER\ITShop\PersonInsertedNoDecide') = '1' then @uid_personinserted else null end  left outer join QER_VPersonsAreMe apo on pio.UID_Person = apo.UID_PersonAlsoMe
8 and apo.UID_PersonOrigin = case when @uid_personordered > ' ' and @IgnoreNoDecideForPerson = 0 and dbo.QBM_FGIConfigparmValue('QER\ITShop\PersonOrderedNoDecide'
9) = '1' then @uid_personordered else null end  group by z.treelevel, z.UID_Org having min(api.UID_PersonAlsoMe ) is null and min(apo.UID_PersonAlsoMe )
10 is null order by z.treelevel desc  ) as oo join PersonInBaseTree pib on oo.UID_Org = pib.UID_Org left outer join PersonWantsOrg pwo on pwo.ObjectKeyAssignment
11 = pib.XObjectKey and pib.XOrigin > 0 and pwo.OrderState in ('Assigned', 'OrderProlongate', 'OrderUnsubscribe' ) ) 
12

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:36.133

None extracted.

Summary: reads/joins BaseTreeCollection, BaseTree, OrgRoot, PersonInBaseTree, QER_VPersonsAreMe…; uses config QER\ITShop\PersonInsertedNoDecide, QER\ITShop\PersonOrderedNoDecide

Declared parameters

ParameterTypeDirection
@uid_orgvarchar(38)input
@uid_personinsertedvarchar(38)input
@uid_personorderedvarchar(38)input
@WithFallBackRootbitinput
@IgnoreNoDecideForPersonbitinput

DML targets

None extracted.

Called routines

None extracted.

Config/session

Config: QER\ITShop\PersonInsertedNoDecide QER\ITShop\PersonOrderedNoDecide

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @uid_org @uid_personinserted @uid_personordered @WithFallBackRoot @IgnoreNoDecideForPerson

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.