dbo.QER_FTPersonHeadCirc_BaseTree
SQL_TABLE_VALUED_FUNCTION
Created 2026-04-14T23:20:36.427 · modified 2026-04-14T23:20:36.427 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
@UID_OrgRoot | varchar | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| BaseTree | OBJECT_OR_COLUMN | ||
| BaseTreeCollectionF | OBJECT_OR_COLUMN | ||
| HelperHeadOrg | OBJECT_OR_COLUMN | ||
| HelperPersonOrg | OBJECT_OR_COLUMN | ||
| PersonWantsOrg | OBJECT_OR_COLUMN | ||
| QER_YPersonHeadCircular | TYPE | ||
| dbo | QER_FTPersonHeadCirc_calc | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1create function dbo.QER_FTPersonHeadCirc_BaseTree( @UID_OrgRoot varchar(38) = null ) returns @erg table ( UID_Person varchar(38) collate database_default 2 Not Null , UID_PersonHead varchar(38) collate database_default Not Null , IsDelegationContained bit default 0 ) as begin declare @work QER_YPersonHeadCircular 3 insert into @work(uid_person, uid_personhead , IsDirectReportsContained , IsHeadOrgContained , IsCircular , IsDelegationContained , IsDirectReportsOnly 4 ) select x.UID_Person, x.UID_PersonHead , MAX(x.IsDirectReportsContained) , max(x.IsHeadOrgContained ) , 0 as IsCircular , max(IsDelegationContained 5) , min(IsDirectReportsOnly) from ( select pio.UID_Person, h.UID_PersonHead , 0 as IsDirectReportsContained , 1 as IsHeadOrgContained , 0 as LevelNumber 6 , 0 as IsCircular , sign(len(isnull(d1.UID_PersonWantsOrg, ''))) as IsDelegationContained , 0 as IsDirectReportsOnly from HelperPersonOrg pio join HelperHeadOrg 7 h on pio.UID_Org = h.UID_Org join BaseTree b on h.UID_Org = b.UID_Org left outer join PersonWantsOrg d1 on d1.ObjectKeyAssignment = h.XObjectKey and d1.OrderState 8 in ('OrderProlongate', 'Assigned', 'OrderUnsubscribe') where isnull(@UID_OrgRoot, b.UID_OrgRoot) = b.UID_OrgRoot and exists (select top 1 1 from HelperHeadOrg 9 ha where ha.UID_PersonHead = pio.UID_Person ) and not exists (select top 1 1 from HelperPersonOrg po where po.UID_Org = h.UID_Org and po.UID_Person = 10 pio.UID_Person ) union all select h.UID_PersonHead as UID_Person, ho.UID_PersonHead , 0 as IsDirectReportsContained , 1 as IsHeadOrgContained , 0 as 11LevelNumber , 0 as IsCircular , sign(len(isnull(d1.UID_PersonWantsOrg, '')) + len(isnull(d2.UID_PersonWantsOrg, ''))) as IsDelegationContained , 0 as IsDirectReportsOnly 12 from HelperHeadOrg h join BaseTreeCollectionF co on h.UID_Org = co.UID_Org and co.UID_Org <> co.UID_ParentOrg join HelperHeadOrg ho on co.UID_ParentOrg 13 = ho.UID_Org join BaseTree b on h.UID_Org = b.UID_Org left outer join PersonWantsOrg d1 on d1.ObjectKeyAssignment = h.XObjectKey and d1.OrderState in 14('OrderProlongate', 'Assigned', 'OrderUnsubscribe') left outer join PersonWantsOrg d2 on d2.ObjectKeyAssignment = ho.XObjectKey and d2.OrderState in ('OrderProlongate' 15, 'Assigned', 'OrderUnsubscribe') where isnull(@UID_OrgRoot, b.UID_OrgRoot) = b.UID_OrgRoot ) as x group by x.UID_Person, x.UID_PersonHead having x.UID_Person 16 <> x.UID_PersonHead insert into @erg( UID_Person , UID_PersonHead , IsDelegationContained ) select c.UID_Person , UID_PersonHead , IsDelegationContained 17 from dbo.QER_FTPersonHeadCirc_calc(@work) c return end 18
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.427
None extracted.
Summary: writes INSERT into; reads/joins HelperPersonOrg, HelperHeadOrg, BaseTree, PersonWantsOrg, BaseTreeCollectionF…
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
@UID_OrgRoot | varchar(38) | input |
DML targets
INSERT intoCalled routines
None extracted.
Read/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: None extracted.
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: None extracted.
Variables: @UID_OrgRoot @erg @work
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.