diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 524657a7..9b54c476 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -3458,6 +3458,9 @@ RETURNS @Transitions TABLE WITH EXECUTE AS OWNER AS BEGIN +declare @Type int +select @Type = CC.Type from Contents CC Join Items II ON II.ContentID = CC.ContentID Where ItemID = @ItemID +BEGIN with Itemz([Level], [Ordinal], [ItemID], [PreviousID], [FromType], [ContentID], [DTS], [UserID], [LastChanged],[pContentID], [pDTS],[pUserID],[pLastChanged]) as ( Select 0 [Level], 0 [Ordinal], [ItemID], [PreviousID],0 [FromType],[ContentID],[DTS],[UserID],[LastChanged] ,0 [pContentID],[DTS] [pDTS], [UserID] [pUserID], [LastChanged] [pLastChanged] @@ -3476,7 +3479,7 @@ Union All ,null,null,null,null from Itemz Z join Items I on I.PreviousID = Z.ItemID - --where Z.[Level] > 0 -- This would limit the siblings to the siblings of the children and not the initial ItemID + where @Type >= 20000 OR Z.[Level] > 0 -- This would limit the siblings to the siblings of the children and not the initial ItemID ) , Itemz2([Level], [Ordinal], [ItemID], [PreviousID], [FromType], [ContentID], [DTS], [UserID], [LastChanged],[pContentID], [pDTS],[pUserID],[pLastChanged]) as ( Select 0 [Level], 0 [Ordinal], [ItemID], [PreviousID],0 [FromType],[ContentID],[DTS],[UserID],[LastChanged] @@ -3489,7 +3492,7 @@ Union All ,null,null,null,null from Itemz2 Z join Items I on Z.PreviousID = I.ItemID - --where Z.[Level] > 0 -- This would limit the siblings to the siblings of the children and not the initial ItemID + where @Type >= 20000 OR Z.[Level] > 0 -- This would limit the siblings to the siblings of the children and not the initial ItemID ) insert into @Transitions select TransitionID from Transitions TT @@ -3500,6 +3503,8 @@ JOIN Itemz2 on ToID=ItemID and RangeID=ItemID and IsRange = 2 OPTION (MAXRECURSION 10000) RETURN END +END + GO -- Display the status of Proc creation IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_FindAffectedTransitions Succeeded'