How do you determine the maximum nested-level of Stored Procedure ?

 Posted by Pandians on 9/3/2009 | Category: Sql Server Interview questions | Views: 7241
Answer:

The current nested level can be determine by : @@NESTLEVEL, The maximum nested level is 32 .

ie:
1. Creating stored procedure :
CREATE PROC PROC_SAMPLE1

AS
BEGIN
PRINT @@NESTLEVEL
EXEC PROC_SAMPLE1
END

2. Executing stored procedure :
EXEC PROC_SAMPLE1

3. Result :
1
2
3
..
..
32
Msg 217, Level 16, State 1, Procedure PROC_SAMPLE1, Line 5
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).


Asked In: General | Alert Moderator 

Comments or Responses

Login to post response