dbo.QER_FTPersonHeadCirc_Person_i

SQL_TABLE_VALUED_FUNCTION

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

Open formatted source/search result

Parameters

NameTypeOutput
@UID_Personvarcharno
@UID_PersonHeadvarcharno
@fallintno

Referenced objects

SchemaObjectColumn/minorClass
HelperHeadPersonOBJECT_OR_COLUMN
PersonOBJECT_OR_COLUMN
PersonWantsOrgOBJECT_OR_COLUMN
QER_YPersonHeadCircularTYPE
dboQBM_FGIBitPatternXOriginOBJECT_OR_COLUMN
dboQER_FTPersonHeadCirc_calcOBJECT_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_FTPersonHeadCirc_Person_i( @UID_Person varchar(38) , @UID_PersonHead varchar(38) , @fall int  ) returns @erg table ( UID_Person
2 varchar(38) collate database_default Not Null , UID_PersonHead varchar(38) collate database_default Not Null , IsDirectReportsOnly bit default 0  , IsDelegationContained
3 bit default 0 ) as begin declare @work QER_YPersonHeadCircular declare @HeadOld varchar(38) = null  if @Fall = 1 begin goto endLabel end if @Fall in (0
4,2)  begin insert into @work(uid_person, uid_personhead , IsDirectReportsContained , IsHeadOrgContained  , IsCircular , IsDelegationContained , IsDirectReportsOnly
5  ) select x.UID_Person, x.UID_PersonHead , MAX(x.IsDirectReportsContained) , max(x.IsHeadOrgContained )  , 0 as IsCircular , max(IsDelegationContained
6) , min(IsDirectReportsOnly)  from (  select h.UID_Person, h.UID_PersonHead , 1 as IsDirectReportsContained , 0 as IsHeadOrgContained  , 0 as IsCircular
7 , sign(len(isnull(d1.UID_PersonWantsOrg, ''))) as IsDelegationContained , sign(h.XOrigin & dbo.QBM_FGIBitPatternXOrigin('|Direct|', 0)) as IsDirectReportsOnly
8 from HelperHeadPerson h left outer join PersonWantsOrg d1 on d1.ObjectKeyAssignment = h.XObjectKey and d1.OrderState in ('OrderProlongate', 'Assigned'
9, 'OrderUnsubscribe')      union all  select h.UID_Person, h.UID_PersonHead , 1 as IsDirectReportsContained , 0 as IsHeadOrgContained  , 0 as IsCircular
10 , 0 as IsDelegationContained , 1 as IsDirectReportsOnly from Person h where h.UID_Person = @UID_Person or h.UID_PersonHead = @UID_Person            ) 
11as x group by x.UID_Person, x.UID_PersonHead having x.UID_Person <> x.UID_PersonHead end else  begin  select top 1 @HeadOld = p.UID_PersonHead from Person
12 p where p.UID_Person = @UID_Person select @HeadOld = ISNULL(@HeadOld, '#') insert into @work(uid_person, uid_personhead , IsDirectReportsContained , IsHeadOrgContained
13  , IsCircular , IsDelegationContained , IsDirectReportsOnly  ) select x.UID_Person, x.UID_PersonHead , MAX(x.IsDirectReportsContained) , max(x.IsHeadOrgContained
14 )  , 0 as IsCircular , max(IsDelegationContained) , min(IsDirectReportsOnly)  from (  select h.UID_Person, h.UID_PersonHead , 1 as IsDirectReportsContained
15 , 0 as IsHeadOrgContained  , 0 as IsCircular , sign(len(isnull(d1.UID_PersonWantsOrg, ''))) as IsDelegationContained , sign(h.XOrigin & dbo.QBM_FGIBitPatternXOrigin
16('|Direct|', 0)) as IsDirectReportsOnly from HelperHeadPerson h left outer join PersonWantsOrg d1 on d1.ObjectKeyAssignment = h.XObjectKey and d1.OrderState
17 in ('OrderProlongate', 'Assigned', 'OrderUnsubscribe')  where not (h.UID_Person = @UID_Person and h.UID_PersonHead = @HeadOld )   and h.XOrigin & dbo.QBM_FGIBitPatternXOrigin
18('|Pwo|', 1) > 0              union all select @UID_Person, @UID_PersonHead , 1 as IsDirectReportsContained , 0 as IsHeadOrgContained  , 0 as IsCircular
19 , 0 as IsDelegationContained , 1 as IsDirectReportsOnly ) as x group by x.UID_Person, x.UID_PersonHead having x.UID_Person <> x.UID_PersonHead  if @UID_Person
20 = @UID_PersonHead  begin insert into @work(uid_person, uid_personhead , IsDirectReportsContained , IsHeadOrgContained , IsCircular , IsDelegationContained
21 , IsDirectReportsOnly ) select @UID_Person, @UID_PersonHead, 1, 0, 1, 0, 1 end end Berechnung: insert into @erg( UID_Person , UID_PersonHead  , IsDirectReportsOnly
22  , IsDelegationContained  ) select c.UID_Person , UID_PersonHead  , IsDirectReportsOnly  , IsDelegationContained  from dbo.QER_FTPersonHeadCirc_calc(@work
23) c where ( c.UID_Person = @UID_Person or c.UID_PersonHead = @UID_Person or @UID_Person is null ) endLabel: return end 
24

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

None extracted.

Summary: writes INSERT into; reads/joins HelperHeadPerson, PersonWantsOrg, Person, QER_FTPersonHeadCirc_calc

Declared parameters

ParameterTypeDirection
@UID_Personvarchar(38)input
@UID_PersonHeadvarchar(38)input
@fallintinput

DML targets

INSERT into

Called routines

None extracted.

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @UID_Person @UID_PersonHead @fall @erg @work @HeadOld @Fall

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_NewHeadSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QER_FTPersonHeadCirc_PersonSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QER_FTPersonHeadCirc_NewHeadsource text referenceSQL_INLINE_TABLE_VALUED_FUNCTION
dbo.QER_FTPersonHeadCirc_Personsource text referenceSQL_INLINE_TABLE_VALUED_FUNCTION