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

时间:2017-10-03 08:32:35

标签: c# caching sqlexception

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

  

发生了System.Data.SqlClient.SqlException     的HResult = 0x80131904     消息=超出最大存储过程,函数,触发器或视图嵌套级别(限制32)。     Source = .Net SqlClient数据提供程序     堆栈跟踪:

它会在以下代码中引发错误

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
我在做错了什么?因为完全相同的代码和数据库在其他机器上工作正常。我确实看了堆栈流上提到的其他类似错误,但没有任何帮助。

    --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

1 个答案:

答案 0 :(得分:0)

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