This article has been archived. It is offered "as is" and will no longer be updated.
For a Microsoft SQL Server 2000 Service Pack 2 version of this article, see 818406.
Bug #: 469157 (SQL Server 8.0)
When you run a Transact-SQL statement that references many views, the Transact-SQL statement may fail, and you receive the following error message:
"Server: Msg 4414, Level 16, State 1, Line 1 Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (256) was exceeded."
Service pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 How to obtain the latest SQL Server 2000 service pack
The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.
The maximum number of tables that can be referred in a SELECT Transact-SQL statement is 256. This limit is documented under the "Maximum Capacity Specifications" section of the SQL Server Books Online. This limit includes views and the tables that are referenced in the SELECT statement. Also, the limit includes the tables and the views that are referenced by a view that is included in the query. Therefore, if a table or a view is referenced more than one time in the query, each reference to the table or the view (or the tables and views that are referenced in the view) counts against this limit.
With this fix, the maximum limit of the number of tables or views that are referenced in the query is increased to 260. Therefore, you may still receive the error message that is mentioned in the "Symptoms" section of this article. If you still receive the "Msg 4414" error message, you may have to break up the query so that a lower number of tables or views are referenced in the query. You may change the view definition that is referenced in the problematic query to lower the number of tables that are referenced in the view.
For additional information about a SQL Server 2000 Service Pack 2 version of this hotfix, click the following article number to view the article in the Microsoft Knowledge Base:
818406 FIX: A Transact-SQL query that uses views may fail unexpectedly in SQL Server 2000 S