Article ID: 324362 - Last Review: January 29, 2007 - Revision: 6.3 Subqueries that you define on merge articles are not re-evaluatedThis article was previously published under Q324362 SYMPTOMS When you use subqueries to filter data in a merge
publication, the subquery is not re-evaluated after the initial
synchronization, which may generate unexpected results at the Subscriber.
CAUSE This behavior occurs because the query is not re-evaluated
and the row is not propagated as part of replication when you update a row in a
table that is referenced by a subquery. Although you can place a subquery in a
row filter, it is not a join filter. Although you can define a subquery that is
based on data from another table, this too can cause unexpected results at the
Subscriber. RESOLUTION To resolve this behavior, use a join filter when you want
the filter definition to be re-evaluated during every merge synchronization
process. STATUSThis
behavior is by design. MORE INFORMATION A fundamental design goal for merge replication is to
partition the data in such a way that each Subscriber receives the smallest
data set possible. One technique to implement this is to define subset filter
clauses. With a subset filter clause, which is an article property, you can
define a logical expression. You can use this logical expression in the WHERE
clause of queries to evaluate data that is to be replicated to the subscribing
tables. You can also include a subquery in the subset filter clauses. For example, a Customers table at the Publisher contains customer data for several states, and an Orders table tracks product orders. Consider the following initial data at the Publisher: When this publication is synchronized the initial synchronization process honors the preceding subquery and therefore the following data is sent to the Subscriber: REFERENCES The following excerpt is under the "Join Filters" topic in
SQL Server Books Online:
Although you can put a subquery into a row filter, it is not a join filter. If you update a row in a table referenced by a subquery, the query will not be re-evaluated and the row will not be propagated as part of replication. Replication join filters exist only for merge replication.
The following excerpt is under the "Filter Table Rows" topic in
SQL Server Books Online:
You can filter the rows in a table to reduce the amount of data being published. The filter statement must refer only to columns and values in that table. Filters cannot refer to data in other tables to determine whether rows of this table are included or excluded.
| Article Translations
|
Back to the top
