dbo.TSB_FTAttCasesForManager
Table FunctionSQL_TABLE_VALUED_FUNCTIONSandbox DB
Interpretation
- Database function. Usually supports views, validation, or calculated predicates; look at referenced-by entries for callers.
Relations
- No extracted relations.
Typed Edges
- references source dbo.QBM_FGISessionContext source text reference
Complete Source
1CREATE FUNCTION dbo.TSB_FTAttCasesForManager(2 @UID_PersonHead varchar(38)3) RETURNS @erg TABLE(UID_AttestationCase varchar(38) collate database_default4)5AS6BEGIN7 IF dbo.QBM_FGISessionContext('ATTCaseAccessAsManagerReduced') = ''8 BEGIN9 INSERT INTO @erg(UID_AttestationCase)10 SELECT ac.UID_AttestationCase11 FROM(12 SELECT h1.UID_Person13 FROM HelperPersonOrg h114 JOIN HelperHeadOrg hho15 ON h1.UID_Org = hho.UID_Org16 WHERE17 hho.UID_PersonHead = @UID_PersonHead18 UNION19 SELECT h2.UID_Person20 FROM PersonInBaseTree h221 JOIN HelperHeadOrg hho22 ON h2.UID_Org = hho.UID_Org23 WHERE24 hho.UID_PersonHead = @UID_PersonHead25 UNION26 SELECT h3.UID_Person27 FROM HelperHeadPerson h328 WHERE29 h3.UID_PersonHead = @UID_PersonHead) AS pe30 JOIN UNSAccount u31 ON u.UID_Person = pe.UID_Person32 LEFT33 OUTER34 JOIN UNSAccountInUNSGroup uig35 ON u.UID_UNSAccount = uig.UID_UNSAccount36 JOIN AttestationCase ac37 ON ac.ObjectKeyBase = u.XObjectKey OR ac.ObjectKeyBase = uig.XObjectKey38 END39 endLabel:40 RETURN41END
Open raw exported source
1create function dbo.TSB_FTAttCasesForManager(@UID_PersonHead varchar(38)) returns @erg table (UID_AttestationCase varchar(38) collate database_default)2 as begin if dbo.QBM_FGISessionContext('ATTCaseAccessAsManagerReduced') = '' begin insert into @erg(UID_AttestationCase) select ac.UID_AttestationCase 3from ( select h1.UID_Person from HelperPersonOrg h1 join HelperHeadOrg hho on h1.UID_Org = hho.UID_Org where hho.UID_PersonHead = @UID_PersonHead union4 select h2.UID_Person from PersonInBaseTree h2 join HelperHeadOrg hho on h2.UID_Org = hho.UID_Org where hho.UID_PersonHead = @UID_PersonHead union select5 h3.UID_Person from HelperHeadPerson h3 where h3.UID_PersonHead = @UID_PersonHead ) as pe join UNSAccount u on u.UID_Person = pe.UID_Person left outer 6join UNSAccountInUNSGroup uig on u.UID_UNSAccount = uig.UID_UNSAccount join AttestationCase ac on ac.ObjectKeyBase = u.XObjectKey or ac.ObjectKeyBase =7 uig.XObjectKey end endLabel: return end 8