INF: Stored Procedures Can Be Nested 16 Levels Deep (47465)



The information in this article applies to:

  • Microsoft SQL Server 4.2x
  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5
  • Microsoft SQL Server 7.0

This article was previously published under Q47465
You can nest stored procedures in Microsoft SQL Server (that is, one stored procedure can call another). There is a limit of 16 levels (32 for SQL Server 7.0 and later) when nesting stored procedures. Attempting to exceed the maximum number of levels of nesting causes the whole calling procedure chain to fail, and an overflow error occurs. The current nesting level is stored in the @@nestlevel global variable.


Modification Type:MinorLast Reviewed:2/14/2005
Keywords:kbProgramming KB47465