简体   繁体   English

SQL错误:超出最大存储过程,函数,触发器或视图嵌套级别

[英]SQL Error: Maximum stored procedure, function, trigger, or view nesting level exceeded

I want to display the data based on the date I selected, [fnDateTxtToWeekNum] will return the weeknum of the date I selected, weeknum is a parameter of [fnBenchmarkData], all available weeknum info stored in the dbo.Weeks table. 我想显示基于所选日期的数据,[fnDateTxtToWeekNum]将返回所选日期的星期数,weeknum是[fnBenchmarkData]的参数,所有可用的Weeknum信息存储在dbo.Weeks表中。

I am getting this error: 我收到此错误:

"Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)." “超出了最大存储过程,函数,触发器或视图嵌套级别(限制32)。”

SELECT  p.weeknum, p.date, q.ID, q.score
FROM dbo.Weeks AS p 
cross apply
[dbo].fnBenchmarkData(p.weeknum) as q 
where weeknum = [dbo].[fnDateTxtToWeekNum]('2015-07-02')

Was it because I referenced weeknum twice and have the function calling it self? 是因为我两次引用了Weeknum并让函数调用了self吗? The @weeknum on fnBenchmarkData is referencing dbo.weeks (basically if without where clause, this SQL will return all data for all weeks). fnBenchmarkData上的@weeknum引用dbo.weeks(基本上,如果没有where子句,则此SQL将返回所有星期的所有数据)。 Then I use fnDateTxtToWeeknum, it will return a weeknumber, basically I create a filter so the SQL will only display the data of that specific week I need (convert date I entered to a weeknum). 然后,我使用fnDateTxtToWeeknum,它将返回一个weeknumber,基本上,我创建了一个过滤器,因此SQL将仅显示我需要的特定星期的数据(将输入的日期转换为weeknum)。

/* I need the final output has both weeknum, date, ID, and score. / *我需要最终输出同时包含Weeknum,日期,ID和得分。 The fnBenchmarkData will NOT return weeknum and date infomation by itself, that's why I need to use cross apply. fnBenchmarkData不会单独返回weeknum和date信息,这就是为什么我需要使用交叉应用。 */ * /

I would say the issue might reside inside the function. 我会说问题可能存在于函数中。 Are you using recursion inside the function? 您在函数内部使用递归吗? If you are you might consider using a while-loop to get rid of it. 如果您是,则可以考虑使用while循环来摆脱它。 Looks like you have a recursive issue here. 看来您这里有一个递归问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 超出最大存储过程,函数,触发器或视图嵌套级别 - maximum stored procedure, function, trigger, or view nesting level exceeded 触发器引发错误超出最大存储过程,函数,触发器或视图嵌套级别 - Trigger throws error Maximum stored procedure, function, trigger, or view nesting level exceeded Visual Studio(ado.net)中超出了最大存储过程,函数,触发器或视图嵌套级别,但SQL服务器中没有 - Maximum stored procedure, function, trigger, or view nesting level exceeded in Visual Studio (ado.net) but not in SQL server 使用SQL Server 2014超出最大存储过程,函数,触发器或视图嵌套级别(限制32) - Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32) using SQL Server 2014 如何解决最大存储过程,function,触发器,或视图嵌套级别超出(限制32) - How to solve maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32) TSQL光标将存储过程称为“超出视图嵌套级别” - TSQL Cursor calls Stored Procedure 'View Nesting Level Exceeded' 触发原因 超出最大触发嵌套级别 - Trigger causing Maximum trigger nesting level exceeded 如何修复嵌套级别超出SQL中的递归函数错误 - How to fix nesting level exceeded Error with recursive function in SQL COUNT(*)最大函数嵌套级别 - COUNT(*) Maximum function nesting level 触发后SQL Server中的最大级别嵌套 - Maximum Nesting of levels in SQL Server after trigger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM