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 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 join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal] order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END END
GO GO
-- Display the status of Proc creation -- 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' ELSE PRINT 'Procedure Creation: getItemAudits Error on Creation'
GO 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] ******/ /****** Object: StoredProcedure [getItemNextAndChildren] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemNextAndChildren]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemNextAndChildren]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getItemNextAndChildren]; 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 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 join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal] order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END END
GO GO
-- Display the status of Proc creation -- Display the status of Proc creation
@ -14545,6 +14513,7 @@ Union All
where Z.Direction >= 0 where Z.Direction >= 0
) )
Select @Count = Count(*) from Itemz Select @Count = Count(*) from Itemz
OPTION (MAXRECURSION 10000)
return @Count END; return @Count END;
GO GO
-- Display the status of Proc creation -- Display the status of Proc creation
@ -14591,6 +14560,7 @@ Insert into @HighLevelStepTransitions
select [ParentID],ItemID,Ordinal,dbo.ve_GetPath([ItemID]) Path select [ParentID],ItemID,Ordinal,dbo.ve_GetPath([ItemID]) Path
from Itemz from Itemz
Order by ParentID,ItemID Order by ParentID,ItemID
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO 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_FindExternalTransitions(ItemID)) > 0
OR(Select count(*) from vefn_FindInternalTransitions(ItemID)) > 0 OR(Select count(*) from vefn_FindInternalTransitions(ItemID)) > 0
Order by ParentID,ItemID Order by ParentID,ItemID
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -14780,6 +14751,7 @@ Union All
where Z.[Level] > 0 where Z.[Level] > 0
) )
insert into @Children select ItemID, ContentID from Itemz insert into @Children select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -14831,6 +14803,7 @@ JOIN [Contents] C on I.ContentID = C.ContentID
where FoundEnd = 0 where FoundEnd = 0
) )
insert into @Children select ItemID, ContentID, FormatID from Itemz insert into @Children select ItemID, ContentID, FormatID from Itemz
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
END END
@ -14885,6 +14858,7 @@ Union All
where Z.[Level] > 0 where Z.[Level] > 0
) )
insert into @Children select ItemID, ContentID from Itemz insert into @Children select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -15097,6 +15071,7 @@ where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz)
UNION UNION
select TransitionID from Transitions TT select TransitionID from Transitions TT
JOIN Itemz2 on ToID=ItemID and RangeID=ItemID and IsRange = 2 JOIN Itemz2 on ToID=ItemID and RangeID=ItemID and IsRange = 2
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO 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 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)) 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) AND FromID not in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -15259,6 +15235,7 @@ select ItemID [FromItemID], TT.[TransitionID], TT.[FromID], TT.[ToID], TT.[Range
join Items II on II.ContentID=TT.FromID join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz)) where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
AND FromID not in(Select ContentID from ItemZ) AND FromID not in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO 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 join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz)) where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
AND FromID in(Select ContentID from ItemZ) AND FromID in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO 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 join Items II on II.ContentID=TT.FromID
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz)) where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
AND FromID in(Select ContentID from ItemZ) AND FromID in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -16250,7 +16229,7 @@ BEGIN
where Z.FormatID is null where Z.FormatID is null
) )
Select @FormatID = FormatID from Itemz ZZ Where FormatID is not null Select @FormatID = FormatID from Itemz ZZ Where FormatID is not null
OPTION (MAXRECURSION 10000)
RETURN @FormatID RETURN @FormatID
END END
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_FindExternalTransitions(ItemID)) ExternalTransitions
,(Select count(*) from vefn_FindInternalTransitions(ItemID)) InternalTransitions ,(Select count(*) from vefn_FindInternalTransitions(ItemID)) InternalTransitions
from Itemz from Itemz
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -16908,6 +16888,7 @@ Union All
join Items I on I.PreviousID = Z.ItemID join Items I on I.PreviousID = Z.ItemID
) )
insert into @SiblingChildren select ItemID, ContentID from Itemz insert into @SiblingChildren select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -16953,6 +16934,7 @@ Union All
join Items I on I.PreviousID = Z.ItemID join Items I on I.PreviousID = Z.ItemID
) )
insert into @Siblings select ItemID, ContentID from Itemz insert into @Siblings select ItemID, ContentID from Itemz
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO
@ -17141,6 +17123,7 @@ UNION ALL
select ii.itemid from items ii join itemz zz on zz.itemid = ii.previousid select ii.itemid from items ii join itemz zz on zz.itemid = ii.previousid
) )
delete from items where itemid in (select itemid from itemz) delete from items where itemid in (select itemid from itemz)
OPTION (MAXRECURSION 10000)
END END
IF( @@TRANCOUNT > 0 ) COMMIT IF( @@TRANCOUNT > 0 ) COMMIT
END TRY END TRY
@ -17569,6 +17552,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI
from ItemZ I from ItemZ I
join Contents C on C.ContentID = I.ContentID join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal] order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END END
GO GO
-- Display the status of Proc creation -- 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 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 where Item=1
order by ZZ.BaseID,ZZ.Level Desc, Item Desc order by ZZ.BaseID,ZZ.Level Desc, Item Desc
OPTION (MAXRECURSION 10000)
end end
GO GO
-- Display the status of Proc creation -- 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 from ItemZ I
join Contents C on C.ContentID = I.ContentID join Contents C on C.ContentID = I.ContentID
order by I.[Level] , I.[FromType], I.[Ordinal] order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END END
GO GO
-- Display the status of Proc creation -- 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 join Items II on II.ContentID=TT.FromID
where (ToID not in(select ItemID from Itemz) OR RangeID not in(select ItemID from Itemz)) where (ToID not in(select ItemID from Itemz) OR RangeID not in(select ItemID from Itemz))
AND FromID in(Select ContentID from ItemZ) AND FromID in(Select ContentID from ItemZ)
OPTION (MAXRECURSION 10000)
RETURN RETURN
END END
GO GO

View File

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