Maximum view nesting level exceeded

  • I am trying to move our SQL Server 2000 databases over to SQL Server 2005. Things are moved over keeping the 8.0 format for right now. I have hit a problem with one of my MAJOR views - it works just fine in 2000 but gives the following error in 2005 :crying: :

    Msg 217, Level 16, State 1, Line 2

    Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

    Any suggestions on what to do to fix the problem??

    Thanks!

    mj 🙂

    ~mj

  • Sounds like the view is selecting from another view, which is selecting from another view, which is .....

    You need to look at the first view, see where it is selecting from, and then just trace it through by looking at the view definitions.

    As you are doing that, try to look at the logic of what it is doing and convert it to a single view. Much more efficient.

  • Thanks for the suggestion. That is what I started to do and oddly enough, I just discovered the problem - the view was using a user-defined function that runs a cursor from the original view (total recursion) I was able to make a couple of adjustments to get it working again.

    Thanks!

    Michelle

    ~mj

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply