Back to OIM Explorer

dbo.QER_FTPWOOrderPerson_000

Inline Table FunctionSQL_INLINE_TABLE_VALUED_FUNCTIONSandbox DB

Inline Table Function.

Source: sandbox-db sys.sql_modules

Source size: 1.985 characters

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

SQL53 lines
1CREATE FUNCTION dbo.QER_FTPWOOrderPerson_000(2  @dummyUID_PersonOrdered varchar(38),3  @dummyUID_ITShopOrgPR varchar(38),4  @dummyUID_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'24JOIN BaseTree cu25  ON bo.UID_ParentOrg = cu.UID_ParentOrg AND cu.ITShopInfo = 'CU'26JOIN PersonInBaseTree cum27  ON cu.uid_org = cum.uid_org AND cum.XOrigin > 028JOIN AccProduct a29  ON pr.uid_accproduct = a.uid_accproduct AND a.IsInactive = 030JOIN BaseTreeAssign ba31  WITH(readpast)32  ON ba.IsITShopEnabled = 133JOIN DialogTable t34  WITH(readpast)35  ON ba.UID_DialogTableElement = t.UID_DialogTable36JOIN BaseTreeHasObject bho37  ON pr.UID_Org = bho.UID_Org AND bho.InheritInfo = 1 AND bho.ObjectKey LIKE '<Key><T>' + t.TableName + '</T>%'38LEFT39OUTER40JOIN QERAssign qa41  ON bho.ObjectKey = qa.XObjectKey42WHERE43  1 = CASE44WHEN @ValidFrom IS NULL AND @ValidUntil IS NULL THEN45146WHEN((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1) & ba.IsReusePossible) = 1 AND @ValidFrom IS NULL AND @ValidUntil IS NULL THEN47148WHEN((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1) & ba.IsReusePossible) = 1 THEN49dbo.QER_FGIPwoValidDateRangesExist(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil)50WHEN dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting'), 0) = 2 THEN51152ELSE dbo.QER_FGIPwoValidDateRangesExist(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil)53END)
Open raw exported source
SQL ยท Raw14 lines
1create function dbo.QER_FTPWOOrderPerson_000 (@dummyUID_PersonOrdered varchar(38) , @dummyUID_ITShopOrgPR varchar(38) , @dummyUID_ACCProduct varchar(382) , @ValidFrom 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 BaseTree5 bo on bo.ITShopInfo = 'BO' and bo.uid_Org = pr.UID_ParentOrg and pr.uid_PWODecisionMethod > ' ' and pr.ITShopInfo = 'PR'     join BaseTree cu on bo.UID_ParentOrg6 = cu.UID_ParentOrg and cu.ITShopInfo = 'CU' join PersonInBaseTree cum on cu.uid_org = cum.uid_org and cum.XOrigin > 0     join AccProduct a on pr.uid_accproduct7 = a.uid_accproduct and a.IsInactive = 0     join BaseTreeAssign ba with (readpast) on ba.IsITShopEnabled = 1 join DialogTable t with (readpast) on ba.UID_DialogTableElement8 = t.UID_DialogTable join BaseTreeHasObject bho on pr.UID_Org = bho.UID_Org and bho.InheritInfo = 1  and bho.ObjectKey like '<Key><T>' + t.TableName + 9'</T>%'  left outer join QERAssign qa on bho.ObjectKey = qa.XObjectKey        where 1 = case   when  @ValidFrom is null and @ValidUntil is null then 1 10   when ((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1 ) & ba.IsReusePossible) = 1 and @ValidFrom is null and @ValidUntil is null then 1 when ((sign11(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1 ) & ba.IsReusePossible) = 1 then dbo.QER_FGIPwoValidDateRangesExist(cum.UID_Person, pr.UID_Org, @ValidFrom12, @ValidUntil)    when dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting'), 0) = 2 then 1  else dbo.QER_FGIPwoValidDateRangesExist13(cum.UID_Person, pr.UID_Org, @ValidFrom, @ValidUntil) end ) 14