dbo.QER_FTPersonHeadCirc_calc

SQL_TABLE_VALUED_FUNCTION

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

Open formatted source/search result

Parameters

NameTypeOutput
@soFarQER_YPersonHeadCircularno

Referenced objects

SchemaObjectColumn/minorClass
dboQER_YPersonHeadCircularTYPE

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_FTPersonHeadCirc_calc(@soFar dbo.QER_YPersonHeadCircular readonly ) returns @erg table ( UID_Person varchar(38) collate database_default
2 Not Null , UID_PersonHead varchar(38) collate database_default Not Null   , IsDirectReportsContained bit default 0 , IsDirectReportsOnly bit default 0
3  , IsHeadOrgContained bit default 0 , IsDelegationContained bit default 0  ) with schemabinding as begin declare @work dbo.QER_YPersonHeadCircular declare
4 @lauf int insert into @work( UID_Person , UID_PersonHead , IsDirectReportsContained , IsHeadOrgContained  , IsCircular , IsDelegationContained , IsDirectReportsOnly
5  ) select UID_Person , UID_PersonHead , IsDirectReportsContained , IsHeadOrgContained  , IsCircular , IsDelegationContained , IsDirectReportsOnly from
6 @soFar select @lauf = 1 while @lauf > 0 begin insert into @work(uid_person, uid_personhead , IsDirectReportsContained , IsHeadOrgContained  , IsCircular
7 , IsDelegationContained , IsDirectReportsOnly  ) select l.uid_person, h.uid_personhead , max(convert(int, l.IsDirectReportsContained | h.IsDirectReportsContained
8)) as IsDirectReportsContained , max(convert(int, l.IsHeadOrgContained | h.IsHeadOrgContained)) as IsHeadOrgContained      , 0 as IsCircular , max(convert
9(int, l.IsDelegationContained | h.IsDelegationContained )) as IsDelegationContained , Min(convert(int, l.IsDirectReportsOnly & h.IsDirectReportsOnly)) 
10as IsDirectReportsOnly  from @work l join @work h on l.UID_PersonHead = h.UID_Person group by l.UID_Person, h.UID_PersonHead having not exists (select 
11top 1 1 from @work e where e.UID_Person = l.UID_Person and e.UID_PersonHead = h.uid_personhead ) and l.UID_Person <> h.UID_PersonHead select @lauf = @@ROWCOUNT
12 end update @work set IsCircular = 1 , IsDelegationContained = l.IsDelegationContained | h.IsDelegationContained , IsDirectReportsContained = l.IsDirectReportsContained
13 | h.IsDirectReportsContained , IsDirectReportsOnly = l.IsDirectReportsOnly & h.IsDirectReportsOnly , IsHeadOrgContained = l.IsHeadOrgContained | h.IsHeadOrgContained
14 from @work l join (select e.UID_PersonHead, e.UID_Person , e.IsDelegationContained, e.IsDirectReportsContained, e.IsDirectReportsOnly, e.IsHeadOrgContained
15 from @work e ) as h on l.uid_person = h.uid_personhead and l.uid_personhead = h.uid_person insert into @erg(UID_Person, UID_PersonHead, IsDirectReportsContained
16, IsDirectReportsOnly , IsDelegationContained, IsHeadOrgContained  ) select UID_Person, UID_PersonHead, IsDirectReportsContained, IsDirectReportsOnly ,
17 IsDelegationContained, IsHeadOrgContained  from @work w where w.IsCircular = 1    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.353

None extracted.

Summary: writes INSERT into

Declared parameters

ParameterTypeDirection
@soFarqer_ypersonheadcircularinput

DML targets

INSERT into

Called routines

None extracted.

Read/join references

None extracted.

SQL dependency metadata

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @soFar @erg @work @lauf @ROWCOUNT

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.

Referencing objectRelationEvidence
dbo.QER_FTPersonHeadCirc_AllSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QER_FTPersonHeadCirc_BaseTreeSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QER_FTPersonHeadCirc_Person_iSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QER_FTPersonHeadCirc_Allsource text referenceSQL_TABLE_VALUED_FUNCTION
dbo.QER_FTPersonHeadCirc_BaseTreesource text referenceSQL_TABLE_VALUED_FUNCTION
dbo.QER_FTPersonHeadCirc_Person_isource text referenceSQL_TABLE_VALUED_FUNCTION