Back to OIM Explorer

dbo.QER_FTPWOOrderPerson_110

Inline Table FunctionSQL_INLINE_TABLE_VALUED_FUNCTIONSandbox DB

Inline Table Function.

Source: sandbox-db sys.sql_modules

Source size: 1.996 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

SQL51 lines
1CREATE FUNCTION dbo.QER_FTPWOOrderPerson_110(2  @UID_PersonOrdered varchar(38),3  @UID_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' AND pr.UID_Org = @UID_ITShopOrgPR24JOIN 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 > 0 AND cum.UID_Person = @UID_PersonOrdered28JOIN 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 bho.UID_Org = @UID_ITShopOrgPR AND bho.InheritInfo = 1 AND bho.ObjectKey LIKE '<Key><T>' + t.TableName + '</T>%'38LEFT39OUTER40JOIN QERAssign qa41  ON bho.ObjectKey = qa.XObjectKey42WHERE43  1 = CASE44WHEN((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1) & ba.IsReusePossible) = 1 AND @ValidFrom IS NULL AND @ValidUntil IS NULL THEN45146WHEN((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1) & ba.IsReusePossible) = 1 THEN47dbo.QER_FGIPwoValidDateRangesExist(@UID_PersonOrdered, @UID_ITShopOrgPR, @ValidFrom, @ValidUntil)48WHEN dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting'), 0) = 2 THEN49150ELSE dbo.QER_FGIPwoValidDateRangesExist(@UID_PersonOrdered, @UID_ITShopOrgPR, @ValidFrom, @ValidUntil)51END)
Open raw exported source
SQL · Raw14 lines
1create function dbo.QER_FTPWOOrderPerson_110 (@UID_PersonOrdered varchar(38) , @UID_ITShopOrgPR varchar(38) , @dummyUID_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_Org = @UID_ITShopOrgPR6 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 and cum.UID_Person = @UID_PersonOrdered join AccProduct a on pr.uid_accproduct = a.uid_accproduct and a.IsInactive = 0     join BaseTreeAssign ba 8with (readpast) on ba.IsITShopEnabled = 1 join DialogTable t with (readpast) on ba.UID_DialogTableElement = t.UID_DialogTable join BaseTreeHasObject bho9 on bho.UID_Org = @UID_ITShopOrgPR and bho.InheritInfo = 1  and bho.ObjectKey like '<Key><T>' + t.TableName + '</T>%'  left outer join QERAssign qa on 10bho.ObjectKey = qa.XObjectKey where 1 = case   when ((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1 ) & ba.IsReusePossible) = 1 and @ValidFrom is 11null and @ValidUntil is null then 1 when ((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1 ) & ba.IsReusePossible) = 1 then dbo.QER_FGIPwoValidDateRangesExist12(@UID_PersonOrdered, @UID_ITShopOrgPR, @ValidFrom, @ValidUntil) when dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting'13), 0) = 2 then 1  else dbo.QER_FGIPwoValidDateRangesExist(@UID_PersonOrdered, @UID_ITShopOrgPR, @ValidFrom, @ValidUntil) end ) 14