FIX: Merge Replication Agent Fails with Error Message: "Unable to replicate a view or function" (299649)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q299649
BUG #: 234529 (SHILOH_BUGS)

SYMPTOMS

If you add a schema only article, such as a view or a stored procedure, to a merge publication without adding the referenced tables, the Merge Agent may fail and this error message occurs:
Error 208: Invalid object name 'object_name'.
Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber.
This behavior may also occur when you add the referenced table to the merge publication after you add the schema only article, and after generating an initial snapshot for the publication.

CAUSE

The sysmergeschemachange merge system table contains information about the published articles that are generated by the Snapshot Agent. When a referenced table is added after the schema only article, the schemaversion of the referenced table is higher than the schemaversion of the schema only article, which causes the error.

RESOLUTION

To resolve this problem, obtain the latest service pack for 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

WORKAROUND

To avoid this behavior when you add a view or stored procedure article to a merge publication, also add all the tables referenced by the view or stored procedure to the merge publication.

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

This problem only occurs when you add a schema only merge article such as a view or stored procedure. This behavior does not occur when you add a table merge article.

Steps to Reproduce Behavior

  1. Create a table named t1 (c1 int primary key,c2 int, c3 uniqueidentifier rowguidcol).
  2. Create a view named t2 as:
     select * from t1
    					
  3. Create a merge publication with t2 as an article.
  4. Run the Snapshot Agent.
  5. Run the Merge Agent.
  6. The Merge Agent fails with this error message:
    Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber.
  7. Add t1 as an article to the merge publication.
  8. Run the Snapshot Agent.
  9. Run the Merge Agent.
  10. The Merge Agent fails with this error message:
    Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber.

Modification Type:MajorLast Reviewed:11/5/2003
Keywords:kbBug kbfix kbSQLServ2000sp1fix KB299649