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.
Parameters
| Name | Type | Output |
|---|---|---|
@soFar | QER_YPersonHeadCircular | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| dbo | QER_YPersonHeadCircular | TYPE |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
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
| Parameter | Type | Direction |
|---|---|---|
@soFar | qer_ypersonheadcircular | input |
DML targets
INSERT intoCalled 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 object | Relation | Evidence |
|---|---|---|
| dbo.QER_FTPersonHeadCirc_All | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPersonHeadCirc_BaseTree | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPersonHeadCirc_Person_i | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPersonHeadCirc_All | source text reference | SQL_TABLE_VALUED_FUNCTION |
| dbo.QER_FTPersonHeadCirc_BaseTree | source text reference | SQL_TABLE_VALUED_FUNCTION |
| dbo.QER_FTPersonHeadCirc_Person_i | source text reference | SQL_TABLE_VALUED_FUNCTION |