dbo.CPL_FTCCSPersonHasObjectWPWO
Inline Table FunctionSQL_INLINE_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.CPL_FTCCSPersonsForPWO source text reference
References
Referenced By
Complete Source
1CREATE FUNCTION dbo.CPL_FTCCSPersonHasObjectWPWO(2 @UID_PersonWantsOrg varchar(38),3 @IsCrossPersonCheck BIT4) RETURNS TABLE5AS6RETURN(7 WITH PersonAll(UID_Person) AS(8SELECT p.UID_Person9FROM dbo.CPL_FTCCSPersonsForPWO(@UID_PersonWantsOrg, @IsCrossPersonCheck) p)10SELECT11 x.UID_PersonWantsOrg,12 x.UID_Person,13CASE14 WHEN Objectkey LIKE '<Key><T>SAPFunctionInstance</T>%' THEN15max(IsNew)16ELSE min(IsNew)17END AS IsNew,18Objectkey,19sign(min(convert(int, IsFromSubIdentityOnly))) AS IsFromSubIdentityOnly20FROM(21SELECT22 0 AS IsNew, @UID_PersonWantsOrg AS UID_PersonWantsOrg, po.uid_person, po.Objectkey, CASE po.InheritInfo23 WHEN 4 THEN24 125ELSE 026END AS IsFromSubIdentityOnly27FROM PersonHasObject po28JOIN PersonAll pe29 ON po.uid_person = pe.UID_Person30WHERE31 ~@IsCrossPersonCheck &(CASE po.InheritInfo32WHEN 4 THEN33134ELSE 035END) = 036UNION all37SELECT38 0 AS IsNew, pho.UID_PersonWantsOrg, pho.uid_person, pho.ObjectKey, pho.IsFromSubIdentityOnly39FROM HelperPWOPersonHasObject pho40JOIN PersonAll pe41 ON pho.UID_Person = pe.UID_Person42WHERE43 pho.UID_PersonWantsOrg <> @UID_PersonWantsOrg AND ~@IsCrossPersonCheck & pho.IsFromSubIdentityOnly = 0 AND pho.isExisting = 044UNION all45SELECT46 ~pho.IsExisting AS IsNew, pho.UID_PersonWantsOrg, pho.uid_person, pho.ObjectKey, pho.IsFromSubIdentityOnly47FROM HelperPWOPersonHasObject pho48WHERE49 pho.UID_PersonWantsOrg = @UID_PersonWantsOrg AND ~@IsCrossPersonCheck & pho.IsFromSubIdentityOnly = 0) AS x50GROUP BY x.UID_PersonWantsOrg,51x.UID_Person,52x.ObjectKey)
Open raw exported source
1 create function dbo.CPL_FTCCSPersonHasObjectWPWO (@UID_PersonWantsOrg varchar(38) , @IsCrossPersonCheck bit ) returns table as return ( with PersonAll2 (UID_Person) as ( select p.UID_Person from dbo.CPL_FTCCSPersonsForPWO (@UID_PersonWantsOrg, @IsCrossPersonCheck) p ) select x.UID_PersonWantsOrg, x.UID_Person3, case when Objectkey like '<Key><T>SAPFunctionInstance</T>%' then max(IsNew) else min(IsNew) end as IsNew , Objectkey , sign(min(convert(int, IsFromSubIdentityOnly4))) as IsFromSubIdentityOnly from ( select 0 as IsNew, @UID_PersonWantsOrg as UID_PersonWantsOrg, po.uid_person, po.Objectkey , case po.InheritInfo when5 4 then 1 else 0 end as IsFromSubIdentityOnly from PersonHasObject po join PersonAll pe on po.uid_person = pe.UID_Person where ~@IsCrossPersonCheck &6 (case po.InheritInfo when 4 then 1 else 0 end) = 0 union all select 0 as IsNew , pho.UID_PersonWantsOrg, pho.uid_person, pho.ObjectKey, pho.IsFromSubIdentityOnly7 from HelperPWOPersonHasObject pho join PersonAll pe on pho.UID_Person = pe.UID_Person where pho.UID_PersonWantsOrg <> @UID_PersonWantsOrg and ~@IsCrossPersonCheck8 & pho.IsFromSubIdentityOnly = 0 and pho.isExisting = 0 union all select ~pho.IsExisting as IsNew, pho.UID_PersonWantsOrg, pho.uid_person, pho.ObjectKey9, pho.IsFromSubIdentityOnly from HelperPWOPersonHasObject pho where pho.UID_PersonWantsOrg = @UID_PersonWantsOrg and ~@IsCrossPersonCheck & pho.IsFromSubIdentityOnly10 = 0 ) as x group by x.UID_PersonWantsOrg, x.UID_Person, x.ObjectKey ) 11