Back to OIM Explorer

dbo.QER_FTPwoValidDateRangeAssign

Table FunctionSQL_TABLE_VALUED_FUNCTIONSandbox DB

Table Function.

Source: sandbox-db sys.sql_modules

Source size: 1.185 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_FTDateTimeGaps source text reference
  • references source dbo.QBM_FCVDatetimeToDatetimeEve source text reference
  • references source dbo.QBM_FCVStringToInt source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference

References

Referenced By

  • No direct source references extracted.

Complete Source

SQL36 lines
1CREATE FUNCTION dbo.QER_FTPwoValidDateRangeAssign(2  @ObjectKeyAssignment varchar(138)3) RETURNS @erg TABLE(FromDatetime datetime,4UntilDatetime datetime5)6AS7BEGIN8  DECLARE @heute datetime = getutcdate()9  DECLARE @ist QBM_YDateTimePair10  DECLARE @GapDefinition int = 011  SELECT12    @GapDefinition = dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapDefinition'),13    0)14  INSERT INTO @ist(FromDate,15  ToDate)16  SELECT CASE17  WHEN isnull(pwo.ValidFrom,18  '1899-12-30') < @heute THEN19  @heute20  ELSE pwo.ValidFrom21  END,22  dbo.QBM_FCVDatetimeToDatetimeEve(isnull(pwo.ValidUntil, '2200-01-01'))23  FROM PersonWantsOrg pwo24  WHERE25    pwo.ObjectKeyAssignment = @ObjectKeyAssignment AND(pwo.OrderState IN('Assigned', 'Granted', 'New',26  'OrderProduct', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') AND @GapDefinition = 0 OR pwo.OrderState IN('Assigned',27  'Granted', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') AND @GapDefinition = 1 OR pwo.OrderState IN('Assigned',28  'OrderProlongate', 'OrderUnsubscribe') AND @GapDefinition = 2)29  INSERT INTO @erg(FromDatetime,30  UntilDatetime)31  SELECT32    g.GapStart,33    g.GapEnd34  FROM dbo.QBM_FTDateTimeGaps(@ist) g endLabel:35  RETURN36END
Open raw exported source
SQL ยท Raw9 lines
1create function dbo.QER_FTPwoValidDateRangeAssign( @ObjectKeyAssignment varchar(138)  ) returns @erg table(FromDatetime datetime , UntilDatetime datetime2 ) as begin declare @heute datetime = getutcdate() declare @ist QBM_YDateTimePair declare @GapDefinition int = 0 select @GapDefinition = dbo.QBM_FCVStringToInt3(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapDefinition'), 0) insert into @ist (FromDate , ToDate) select case when isnull(pwo.ValidFrom, '1899-12-30'4) < @heute then @heute else pwo.ValidFrom end , dbo.QBM_FCVDatetimeToDatetimeEve(isnull(pwo.ValidUntil, '2200-01-01')) from PersonWantsOrg pwo where pwo.ObjectKeyAssignment5 = @ObjectKeyAssignment        and (pwo.OrderState in ('Assigned', 'Granted', 'New', 'OrderProduct', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') 6and @GapDefinition = 0  or pwo.OrderState in ('Assigned', 'Granted', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') and @GapDefinition = 1  or pwo.OrderState7 in ('Assigned', 'OrderProlongate', 'OrderUnsubscribe' ) and @GapDefinition = 2  ) insert into @erg(FromDatetime, UntilDatetime) select g.GapStart, g.GapEnd8 from dbo.QBM_FTDateTimeGaps(@ist) g endLabel: return end 9