dbo.QER_FGIPwoValidDateRangesExist
SQL_SCALAR_FUNCTION
Created 2025-06-27T17:59:26.997 · modified 2026-04-14T23:17:27.300 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
| bit | yes |
@UID_PersonOrdered | varchar | no |
@UID_ITShopOrgPR | varchar | no |
@ValidFrom | datetime | no |
@ValidUntil | datetime | no |
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| BaseTreeAssign | OBJECT_OR_COLUMN | ||
| BaseTreeHasObject | OBJECT_OR_COLUMN | ||
| DialogTable | OBJECT_OR_COLUMN | ||
| PersonWantsOrg | OBJECT_OR_COLUMN | ||
| QBM_YDateTimePair | TYPE | ||
| QERAssign | OBJECT_OR_COLUMN | ||
| dbo | QBM_FCVDatetimeToDatetimeEve | OBJECT_OR_COLUMN | |
| dbo | QBM_FCVStringToInt | OBJECT_OR_COLUMN | |
| dbo | QBM_FGIConfigparmValue | OBJECT_OR_COLUMN | |
| dbo | QBM_FGIDateTimeSpanOverlap | OBJECT_OR_COLUMN | |
| dbo | QBM_FTDateTimeGaps | OBJECT_OR_COLUMN | |
| dbo | QER_FGIBitPatternInheritInfo | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1 create function dbo.QER_FGIPwoValidDateRangesExist(@UID_PersonOrdered varchar(38) , @UID_ITShopOrgPR varchar(38) , @ValidFrom datetime 2 , @ValidUntil datetime ) returns bit as begin declare @wantedFrom datetime declare @wantedUntil datetime declare @erg bit = 1 declare @IsReusePossible 3 bit declare @heute datetime = getutcdate() declare @ObjectKeyAtPR varchar(138) declare @QER_BitPatternInheritInfo int = dbo.QER_FGIBitPatternInheritInfo 4('|Direct|', 0) declare @ist QBM_YDateTimePair declare @Luecke QBM_YDateTimePair declare @GapFitting int = 0 declare @GapDefinition int = 0 select @wantedFrom 5 = ISNULL(@ValidFrom, @heute) select @wantedUntil = ISNULL(@ValidUntil, '2200-01-01') if @wantedFrom < @heute begin select @wantedFrom = @heute end if 6 @wantedUntil < @wantedFrom begin select @erg = 0 goto EndLabel end if @wantedUntil < @heute begin select @erg = 0 goto EndLabel end select top 1 @ObjectKeyAtPR 7 = bho.ObjectKey , @IsReusePossible = ((sign(len(isnull(qa.ObjectKeyAssignTarget, ''))) ^1 ) & ba.IsReusePossible) from DialogTable t with (readpast) join 8 BaseTreeAssign ba with (readpast) on ba.UID_DialogTableElement = t.UID_DialogTable join BaseTreeHasObject bho on bho.ObjectKey like '<Key><T>' + t.TableName 9 + '</T>%' left outer join QERAssign qa on bho.ObjectKey = qa.XObjectKey where bho.UID_Org = @UID_ITShopOrgPR and bho.InheritInfo = @QER_BitPatternInheritInfo 10 if @IsReusePossible = 1 begin goto endLabel end select @GapFitting = dbo.QBM_FCVStringToInt(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapFitting' 11), 0) if @GapFitting = 2 begin goto endlabel end if exists (select top 1 1 from PersonWantsOrg pwo join BaseTreeHasObject bho on pwo.UID_Org = bho.UID_Org 12 and bho.InheritInfo = @QER_BitPatternInheritInfo where bho.ObjectKey = @ObjectKeyAtPR and pwo.UID_PersonOrdered = @UID_PersonOrdered and pwo.OrderState 13 in ('Assigned', 'Granted', 'New', 'OrderProduct', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') ) begin select @GapDefinition = dbo.QBM_FCVStringToInt 14(dbo.QBM_FGIConfigparmValue('QER\ITShop\GapBehavior\GapDefinition'), 0) insert into @ist (FromDate , ToDate) select case when isnull(pwo.ValidFrom, '1899-12-30' 15) < @heute then @heute else pwo.ValidFrom end , dbo.QBM_FCVDatetimeToDatetimeEve(isnull(pwo.ValidUntil, '2200-01-01')) from PersonWantsOrg pwo join BaseTreeHasObject 16 bho on pwo.UID_Org = bho.UID_Org and bho.InheritInfo = @QER_BitPatternInheritInfo where bho.ObjectKey = @ObjectKeyAtPR and pwo.UID_PersonOrdered = @UID_PersonOrdered 17 and (pwo.OrderState in ('Assigned', 'Granted', 'New', 'OrderProduct', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') and @GapDefinition = 0 18 or pwo.OrderState in ('Assigned', 'Granted', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') and @GapDefinition = 1 or pwo.OrderState in ('Assigned' 19, 'OrderProlongate', 'OrderUnsubscribe' ) and @GapDefinition = 2 ) insert into @Luecke(FromDate, ToDate) select g.GapStart, g.GapEnd from dbo.QBM_FTDateTimeGaps 20(@ist) g if @ValidFrom is null and @ValidUntil is null and exists (select top 1 1 from @Luecke ) begin goto endLabel end if @GapFitting = 1 begin if 21not exists (select top 1 1 from @Luecke l where l.FromDate <= @wantedFrom and @wantedUntil <= l.ToDate ) begin select @erg = 0 end end if @GapFitting = 22 0 begin if not exists (select top 1 1 from @Luecke l where dbo.QBM_FGIDateTimeSpanOverlap(@wantedFrom, @wantedUntil, l.FromDate, l.ToDate, 0) = 1 ) begin 23 select @erg = 0 end end end endLabel: return (@erg) end 24
Module relation graph
Loading module relation graph…
Source-derived context
Generated from exported SQL module definitions plus read-only sandbox sys.objects/sys.parameters/sys.sql_expression_dependencies metadata. This is factual source evidence, not a semantic guess.
provenance: SQL definition export provenance: sandbox DB metadata modified: 2026-04-14T23:17:27.300
None extracted.
Summary: writes INSERT into; reads/joins DialogTable, BaseTreeAssign, BaseTreeHasObject, QERAssign, PersonWantsOrg…; uses config QER\ITShop\GapBehavior\GapFitting, QER\ITShop\GapBehavior\GapDefinition
Declared parameters
| Parameter | Type | Direction |
|---|---|---|
| bit | OUTPUT |
@UID_PersonOrdered | varchar(38) | input |
@UID_ITShopOrgPR | varchar(38) | input |
@ValidFrom | datetime | input |
@ValidUntil | datetime | input |
DML targets
INSERT intoCalled routines
None extracted.
Read/join references
SQL dependency metadata
Config/session
Config: QER\ITShop\GapBehavior\GapFitting QER\ITShop\GapBehavior\GapDefinition
Session: None extracted.
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: None extracted.
Variables: @UID_PersonOrdered @UID_ITShopOrgPR @ValidFrom @ValidUntil @wantedFrom @wantedUntil @erg @IsReusePossible @heute @ObjectKeyAtPR @QER_BitPatternInheritInfo @ist @Luecke @GapFitting @GapDefinition
Referenced by / reverse dependencies
Generated from live DB metadata, FK rows, and exported SQL dependency/source extraction. This is factual linkage evidence, not inferred behavior.
| Referencing object | Relation | Evidence |
|---|---|---|
| dbo.QER_FTPWOOrderPerson_000 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_001 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_010 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_011 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_100 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_101 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_110 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QER_FTPWOOrderPerson_111 | SQL expression dependency | dbo · OBJECT_OR_COLUMN |