Added Procedure and Section support to the SQL tbale function vefn_FindAffectedTransitions.

This commit is contained in:
Rich 2014-01-17 21:15:44 +00:00
parent 750c8df895
commit fcee3fae8d

View File

@ -3458,6 +3458,9 @@ RETURNS @Transitions TABLE
WITH EXECUTE AS OWNER WITH EXECUTE AS OWNER
AS AS
BEGIN 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 ( 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] Select 0 [Level], 0 [Ordinal], [ItemID], [PreviousID],0 [FromType],[ContentID],[DTS],[UserID],[LastChanged]
,0 [pContentID],[DTS] [pDTS], [UserID] [pUserID], [LastChanged] [pLastChanged] ,0 [pContentID],[DTS] [pDTS], [UserID] [pUserID], [LastChanged] [pLastChanged]
@ -3476,7 +3479,7 @@ Union All
,null,null,null,null ,null,null,null,null
from Itemz Z from Itemz Z
join Items I on I.PreviousID = Z.ItemID 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 ( , 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] Select 0 [Level], 0 [Ordinal], [ItemID], [PreviousID],0 [FromType],[ContentID],[DTS],[UserID],[LastChanged]
@ -3489,7 +3492,7 @@ Union All
,null,null,null,null ,null,null,null,null
from Itemz2 Z from Itemz2 Z
join Items I on Z.PreviousID = I.ItemID 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 insert into @Transitions
select TransitionID from Transitions TT select TransitionID from Transitions TT
@ -3500,6 +3503,8 @@ JOIN Itemz2 on ToID=ItemID and RangeID=ItemID and IsRange = 2
OPTION (MAXRECURSION 10000) OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
END
GO GO
-- Display the status of Proc creation -- Display the status of Proc creation
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_FindAffectedTransitions Succeeded' IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_FindAffectedTransitions Succeeded'