dbo.QER_FTPWOOrderPerson_001
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.QBM_FCVStringToInt source text reference
- references source dbo.QBM_FGIConfigparmValue source text reference
- references source dbo.QER_FGIPwoValidDateRangesExist source text reference
- references source dbo.QER_FTPWOOrderPerson source text reference
Complete Source
1CREATE FUNCTION dbo.QER_FTPWOOrderPerson_001(2 @dummyUID_PersonOrdered varchar(38),3 @dummyUID_ITShopOrgPR varchar(38),4 @UID_ACCProduct varchar(38),5 @ValidFrom datetime,6 @ValidUntil datetime,7 @CountRecords int8) RETURNS TABLE9AS10RETURN(11SELECT12 DISTINCT TOP(@CountRecords) cum.UID_Person AS UID_PersonOrdered,13 pr.UID_Org AS UID_ITShopOrgPR,14 bo.UID_Org AS UID_ITShopOrgBO,15 bo.UID_ParentOrg AS UID_ITShopOrgSH,16 a.UID_AccProduct AS UID_AccProduct,17 ba.IsReusePossible,18 a.Ident_AccProduct AS Ident_AccProduct,19 a.Description AS Description,20 a.UID_AccProductGroup AS UID_AccProductGroup21FROM BaseTree pr22JOIN BaseTree bo23 ON bo.ITShopInfo = 'BO' AND bo.uid_Org = pr.UID_ParentOrg AND pr.uid_PWODecisionMethod > ' ' AND pr.ITShopInfo = 'PR' AND pr.uid_ACCProduct =24@UID_ACCProduct25JOIN BaseTree cu26 ON bo.UID_ParentOrg = cu.UID_ParentOrg AND cu.ITShopInfo = 'CU'27JOIN PersonInBaseTree cum28 ON cu.uid_org = cum.uid_org AND cum.XOrigin > 029JOIN AccProduct a30 ON a.IsInactive = 0 AND a.UID_AccProduct = @UID_ACCProduct31JOIN BaseTreeAssign ba32 WITH(readpast)33 ON ba.IsITShopEnabled = 134JOIN DialogTable t35 WITH(readpast)36 ON ba.UID_DialogTableElement = t.UID_DialogTable37JOIN BaseTreeHasObject bho38 ON pr.UID_Org = bho.UID_Org AND bho.InheritInfo = 1 AND bho.ObjectKey LIKE '<Key><T>' + t.TableName + '</T>%'39LEFT40OUTER41JOIN QERAssign qa42 ON bho.ObjectKey = qa.XObjectKey43WHERE44 1 = CASE45WHEN @ValidFrom IS NULL AND @ValidUntil IS NULL THEN46147WHEN((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1) & ba.IsReusePossible) = 1 THEN48dbo.QER_FGIPwoValidDateRangesExist(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil)49WHEN dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting'), 0) = 2 THEN50151ELSE dbo.QER_FGIPwoValidDateRangesExist(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil)52END)
Open raw exported source
1create function dbo.QER_FTPWOOrderPerson_001 (@dummyUID_PersonOrdered varchar(38) , @dummyUID_ITShopOrgPR varchar(38) , @UID_ACCProduct varchar(38) , @ValidFrom2 datetime , @ValidUntil datetime , @CountRecords int ) returns table as return ( select distinct top (@CountRecords) cum.UID_Person as UID_PersonOrdered3 , pr.UID_Org as UID_ITShopOrgPR , bo.UID_Org as UID_ITShopOrgBO , bo.UID_ParentOrg as UID_ITShopOrgSH , a.UID_AccProduct as UID_AccProduct , ba.IsReusePossible4 , a.Ident_AccProduct as Ident_AccProduct , a.Description as Description , a.UID_AccProductGroup as UID_AccProductGroup from BaseTree pr join BaseTree 5bo on bo.ITShopInfo = 'BO' and bo.uid_Org = pr.UID_ParentOrg and pr.uid_PWODecisionMethod > ' ' and pr.ITShopInfo = 'PR' and pr.uid_ACCProduct = @UID_ACCProduct6 join BaseTree cu on bo.UID_ParentOrg = cu.UID_ParentOrg and cu.ITShopInfo = 'CU' join PersonInBaseTree cum on cu.uid_org = cum.uid_org and cum.XOrigin7 > 0 join AccProduct a on a.IsInactive = 0 and a.UID_AccProduct = @UID_ACCProduct join BaseTreeAssign ba with (readpast) on ba.IsITShopEnabled = 1 8join DialogTable t with (readpast) on ba.UID_DialogTableElement = t.UID_DialogTable join BaseTreeHasObject bho on pr.UID_Org = bho.UID_Org and bho.InheritInfo9 = 1 and bho.ObjectKey like '<Key><T>' + t.TableName + '</T>%' left outer join QERAssign qa on bho.ObjectKey = qa.XObjectKey where 1 = case when @ValidFrom10 is null and @ValidUntil is null then 1 when ((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1 ) & ba.IsReusePossible) = 1 then dbo.QER_FGIPwoValidDateRangesExist11(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil) when dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting'), 0) =12 2 then 1 else dbo.QER_FGIPwoValidDateRangesExist(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil) end ) 13