Added "OPTION (MAXRECURSION 10000) to all recursive queries. Remove Change Manager stored procedure "getItemAuditsByItemID"

This commit is contained in:
Rich 2012-11-05 21:55:27 +00:00
parent 59b765e6d8
commit 173dd85ccf
4 changed files with 1387 additions and 51 deletions

View File

@ -8896,6 +8896,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI
C.[Number],C.[Text],C.[Type],C.[FormatID],C.[Config],C.[DTS] [cDTS],C.[UserID] [cUserID],C.[LastChanged] [cLastChanged] from ItemZ I
join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END
GO
-- Display the status of Proc creation
@ -8965,40 +8966,6 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getItemAudits Succeeded'
ELSE PRINT 'Procedure Creation: getItemAudits Error on Creation'
GO
/****** Object: StoredProcedure [getItemAuditsByItemID] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemAuditsByItemID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getItemAuditsByItemID];
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[getItemAuditsByItemID]
(
@ItemID int
)
WITH EXECUTE AS OWNER
AS
SELECT
[AuditID],
[ItemID],
[PreviousID],
[ContentID],
[DTS],
[UserID],
[DeleteStatus]
FROM [ItemAudits]
WHERE ItemID = @ItemID
ORDER BY AuditID DESC
RETURN
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: getItemAuditsByItemID Succeeded'
ELSE PRINT 'Procedure Creation: getItemAuditsByItemID Error on Creation'
GO
/****** Object: StoredProcedure [getItemNextAndChildren] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemNextAndChildren]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getItemNextAndChildren];
@ -9033,6 +9000,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI
C.[Number],C.[Text],C.[Type],C.[FormatID],C.[Config],C.[DTS] [cDTS],C.[UserID] [cUserID],C.[LastChanged] [cLastChanged] from ItemZ I
join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END
GO
-- Display the status of Proc creation
@ -14545,6 +14513,7 @@ Union All
where Z.Direction >= 0
)
Select @Count = Count(*) from Itemz
OPTION (MAXRECURSION 10000)
return @Count END;
GO
-- Display the status of Proc creation
@ -14591,6 +14560,7 @@ Insert into @HighLevelStepTransitions
select [ParentID],ItemID,Ordinal,dbo.ve_GetPath([ItemID]) Path
from Itemz
Order by ParentID,ItemID
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -14653,6 +14623,7 @@ where (Select Count(*) from Transitions where ToID=ItemID OR RangeID=ItemID ) >
OR(Select count(*) from vefn_FindExternalTransitions(ItemID)) > 0
OR(Select count(*) from vefn_FindInternalTransitions(ItemID)) > 0
Order by ParentID,ItemID
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -14780,6 +14751,7 @@ Union All
where Z.[Level] > 0
)
insert into @Children select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -14831,6 +14803,7 @@ JOIN [Contents] C on I.ContentID = C.ContentID
where FoundEnd = 0
)
insert into @Children select ItemID, ContentID, FormatID from Itemz
OPTION (MAXRECURSION 10000)
RETURN
END
END
@ -14885,6 +14858,7 @@ Union All
where Z.[Level] > 0
)
insert into @Children select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -15097,6 +15071,7 @@ where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz)
UNION
select TransitionID from Transitions TT
JOIN Itemz2 on ToID=ItemID and RangeID=ItemID and IsRange = 2
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -15199,6 +15174,7 @@ select ItemID [FromItemID], case when TT.ToID in(select ItemID from Itemz) then
join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz where Level > 0) OR RangeID in(select ItemID from Itemz where Level > 0))
AND FromID not in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -15259,6 +15235,7 @@ select ItemID [FromItemID], TT.[TransitionID], TT.[FromID], TT.[ToID], TT.[Range
join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
AND FromID not in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -15314,6 +15291,7 @@ select ItemID [FromItemID], case when TT.ToID in(select ItemID from Itemz) then
join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
AND FromID in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -15373,6 +15351,7 @@ select TransitionID, FromID, TT.TranType, TT.ToID, TT.RangeID, CAST(TT.Config as
join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
AND FromID in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -16250,7 +16229,7 @@ BEGIN
where Z.FormatID is null
)
Select @FormatID = FormatID from Itemz ZZ Where FormatID is not null
OPTION (MAXRECURSION 10000)
RETURN @FormatID
END
END
@ -16487,6 +16466,7 @@ select [ParentID],ItemID,dbo.ve_GetPath([ItemID]) ,(Select Count(*) from Transit
,(Select count(*) from vefn_FindExternalTransitions(ItemID)) ExternalTransitions
,(Select count(*) from vefn_FindInternalTransitions(ItemID)) InternalTransitions
from Itemz
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -16908,6 +16888,7 @@ Union All
join Items I on I.PreviousID = Z.ItemID
)
insert into @SiblingChildren select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -16953,6 +16934,7 @@ Union All
join Items I on I.PreviousID = Z.ItemID
)
insert into @Siblings select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN
END
GO
@ -17141,6 +17123,7 @@ UNION ALL
select ii.itemid from items ii join itemz zz on zz.itemid = ii.previousid
)
delete from items where itemid in (select itemid from itemz)
OPTION (MAXRECURSION 10000)
END
IF( @@TRANCOUNT > 0 ) COMMIT
END TRY
@ -17569,6 +17552,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI
from ItemZ I
join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END
GO
-- Display the status of Proc creation
@ -17615,6 +17599,7 @@ Select ZZ.BaseID,ZZ.Level,MaxItem,ZZ.Number,ZZ.Text from ContentZ ZZ
join (select BaseID, Level, max(item) MaxItem from ContentZ group by BaseID,Level) T1 on T1.BaseID=ZZ.BaseID and T1.Level = ZZ.Level
where Item=1
order by ZZ.BaseID,ZZ.Level Desc, Item Desc
OPTION (MAXRECURSION 10000)
end
GO
-- Display the status of Proc creation
@ -17735,6 +17720,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI
from ItemZ I
join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END
GO
-- Display the status of Proc creation

File diff suppressed because it is too large Load Diff

View File

@ -2764,6 +2764,7 @@ select ItemID [FromItemID], TT.[TransitionID], TT.[FromID], TT.[ToID], TT.[Range
join Items II on II.ContentID=TT.FromID
where (ToID not in(select ItemID from Itemz) OR RangeID not in(select ItemID from Itemz))
AND FromID in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN
END
GO

View File

@ -1338,7 +1338,7 @@ end itemtype
and ia.deletestatus in (select max(deletestatus) from itemaudits where itemid = ia.itemid)
) ia
order by deletestatus desc
OPTION (MAXRECURSION 10000)
--select * from itemz order by parentid,ordinal
RETURN
GO