Microsoft KB Archive/47465

From BetaArchive Wiki
Knowledge Base

INF: Stored Procedures Can Be Nested 16 Levels Deep

Article ID: 47465

Article Last Modified on 2/14/2005


  • Microsoft SQL Server 4.21a Standard Edition
  • Microsoft SQL Server 6.0 Standard Edition
  • Microsoft SQL Server 6.5 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition

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.

Keywords: kbprogramming KB47465