FIX: Replication Snapshot Agent May Fail with Access Violation Error When A Long Filter Clause is Used (243504)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q243504
BUG #: 55635 (SQLBUG_70)

SYMPTOMS

When you use transactional replication, if the publication article uses a filter clause longer than 129 characters, then the snapshot agent may fail with this message in the agent history:
An Access Violation occurred. The Step failed.

WORKAROUND

Use View object to shorten the length of the filter clause to 129 characters or less.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0

For more information, contact your primary support provider.

MORE INFORMATION

The example that follows demonstrates this behavior.

Suppose you have a table named Orders in the publication and you define a horizontal filter on this table as:
Select * from Orders where Orders.emp_id in (select emp_id from Employees inner join Permanent_Employees on Employees.emp_id = Permanent_Employees.emp_id where Employees.emp_id = '10' )
				
This filter clause may cause the Snapshot agent to generate an access violation error because the filter clause exceeds 129 characters in length.

To avoid this error create a View object by using the view in your filter clause:
Create View V_Orders as Employees inner join Permanent_Employees on Employees.emp_id = Permanent_Employees.emp_id where Employees.emp_id = '10' 
				
You can then filter the Orders table with this condition:
Select * from Orders where Orders.emp_id in (select emp_id from V_Orders )
				
This filter clause design avoids the access violation behavior.

Modification Type:MajorLast Reviewed:3/14/2006
Keywords:kbBug kbfix KB243504