Sql 异常:超出最大存储过程..级别

Sql execption: Maximum stored procedure..level exceeded

这是我第一次使用缓存。我在 webconfig.When 中将本地缓存设置为 true 我尝试 运行 我的登录页面出现以下错误

System.Data.SqlClient.SqlException occurred HResult=0x80131904 Message=Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32). Source=.Net SqlClient Data Provider StackTrace:

它在以下代码中抛出错误

lock (lastlevelLock)
        {
            DataSet retval = new DataSet();
            if (UseLocalCache)
            {
                retval =Data.DataRepository.Provider.GetDetailsAll(); // this is where the error comes in

                if (retval == null)
                    retval = new DataSet();
            }
            else

我做错了什么?因为完全相同的代码和数据库在其他 machines.I 上工作正常确实查看了 stackflow 上提到的其他类似错误,但没有任何帮助。

    --WITH ENCRYPTION
AS
BEGIN

;WITH cte AS (
        SELECT  //do selection
        FROM Table g WITH(NOLOCK)
    )
    SELECT //do selection
    INTO #cte
    FROM cte c
        INNER JOIN list.Type gt WITH(NOLOCK) ON c.TypeId = gt.TypeID
        INNER JOIN table.crumb br WITH(NOLOCK) ON c.ID = br.ID
    ORDER BY Lev
    SELECT 
    // select columns
        NULL AS ResultExpected
    INTO #TempGame
    FROM #cte tg
        JOIN list.Type gt WITH(NOLOCK) ON tg.TypeID = gt.TypeID
    WHERE tg.ID IN (
        SELECT ID FROM table2 WITH(NOLOCK)
        WHERE ID = tg.ID

        )


    SELECT 
        //select columns
    INTO #Temp2
    FROM tanbe2 m WITH(NOLOCK)
        INNER JOIN table g WITH(NOLOCK) ON m.ID = g.ID
        //perform all joins
    WHERE m.ID IN (SELECT ID FROM #Temp)

         GETDATE() < ISNULL(m.ResultDateTime, m.ResultExpected) 


    SELECT * FROM #Temp
    SELECT * FROM #Temp2
    ORDER BY ResultExpected

    DROP TABLE #cte
    DROP TABLE #Temp
    DROP TABLE #Temp2


END
GO

在搜索并尝试了多个小时的不同解决方案之后,我终于再次恢复了数据库,它似乎可以正常工作。