Microsoft KB Archive/304532

= FIX: Snapshot Agent Reports &quot;Must Declare the Variable&quot; on Initial Snapshot for Merge Replication =

Article ID: 304532

Article Last Modified on 10/16/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



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 =

ErrorCode = 50007

ErrorText = Must declare the variable '@p19'.

Must declare the variable '@pNN'.

Repl Agent Status: 6

Disconnecting from Publisher ' '



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:  Right-click the Snapshot Agent, and then click Agent Properties. On the Steps tab, edit the Run Agent step. 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.