FIX: Snapshot Agent Reports "Must Declare the Variable" on Initial Snapshot for Merge Replication (304532)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q304532
BUG #: 354866 (SHILOH_BUGS)

SYMPTOMS

The Snapshot Agent fails when it generates an initial snapshot for a merge publication, which occurs if you configure the merge publication with multiple articles, horizontal filters, and vertical filters. When the Snapshot Agent fails, the following error message is displayed:
Must declare the variable '@pNN'.
If detailed error information is captured for the Snapshot Agent, the following error footprint is recorded in the output file:
SourceTypeId = 5
SourceName = SERVER
ErrorCode = 50007
ErrorText = Must declare the variable '@p19'.
Must declare the variable '@pNN'.
Repl Agent Status: 6
Disconnecting from Publisher 'SERVER'

CAUSE

This error occurs because a column that is not part of the vertical filter is included in a Merge Insert Stored procedure.

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

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

MORE INFORMATION

To capture detailed error information:
  1. Right-click the Snapshot Agent, and then click Agent Properties.
  2. On the Steps tab, edit the Run Agent step.
  3. At the end of the string under command, add the following text:

    -Output C:\Temp\OUTPUTFILE.txt -Outputverboselevel 3

Note: You can change the location for the output file as desired. If you use verbose level 3, a notable performance hit on the Snapshot Agent occurs.

REFERENCES

SQL Server 2000 Books Online; topics "Filtering Published Data"; "Row Filters"; "Column Filters"; "Optimizing Synchronization"

Modification Type:MajorLast Reviewed:10/16/2003
Keywords:kbbug kbfix KB304532