Microsoft KB Archive/296045

= FIX: Merge Snapshot Agent Fails with Error 50007: &quot;Too many table names in the query. The maximum allowable is 256.&quot; =

Article ID: 296045

Article Last Modified on 10/31/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q296045



BUG #: 101634 (SQL 7.0)

BUG #: 353729 (SQL 2000)



SYMPTOMS
When you have a merge publication that has a large number of published tables and Join filters, and the dynamic filtering option is enabled in the publication, the Merge Snapshot Agent may fail with this error message:

Error 50007: Too many table names in the query. The maximum allowable is 256. The step failed.

This behavior occurs when the combined number of published tables and Join Filters in the publication is greater than 256, and the @dynamic_filters parameter in the sp_addmergepublication stored procedure is set to TRUE.



CAUSE
During the initial snapshot process, the Snapshot Agent needs to create views on the merge system tables such as MSmerge_contents.

The Snapshot Agent calls the sp_MSmakesystableviews stored procedure, which fails while attempting to create a view with a SELECT query when the combined number of published tables and Join filters exceed 256.

The error occurs because of a product limitation in SQL Server 7.0 and SQL Server 2000. In SQL Server 7.0 and SQL Server 2000 you can only reference up to 256 tables in a view or query.



RESOLUTION
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 INF: How to Obtain the Latest SQL Server 2000 Service Pack

Hotfix
NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:   File name s80415i.exe NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.



WORKAROUND
To work around this problem, use either of these methods:
 * Split the publication into multiple publications so that the combined number of published tables + Join Filters do not exceed 256 in one publication.

-or-


 * Disable the dynamic filtering option in the merge publication by setting the @dynamic_filters parameter in the sp_addmergepublication stored procedure to FALSE.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0.

Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.