Using row filters, you can specify a subset of rows from a table to be published. Row filters can be used when only specific rows need to be propagated to Subscribers, to eliminate rows that users do not need to see (such as rows that contain sensitive or confidential information), or to create different partitions of data that are sent to different Subscribers. For those applications that can, publishing different partitions of data to different Subscribers can also help avoid conflicts that would otherwise be caused by multiple Subscribers updating the same data values.
Row filtering is convenient because it can be applied to existing applications where a site-specific attribute is present to filter on either in the table to be published or in one of its related tables.
In this diagram, the published table is filtered so that only rows 2, 3, and 6 are included in the publication sent to the Subscriber.
Row filters are available with snapshot replication, transactional replication, and merge replication. Row filters in transactional publications may add significant overhead because the article filter clause is evaluated for each log row written for a published table to determine whether it should be marked for replication. Row filters in transactional publications should be avoided where each site can support the full data load, the overall data set is reasonably small, and the number of insert, update, and delete transactions per day is low.
Row filters in snapshot replication and transactional replication are static and the WHERE clause criteria you set in the Create Publication Wizard or the publication properties dialog box stays the same until you modify it. If you had two Subscribers that require different rows of data from the publishing table, you would need two different publications each with a different row filter to retrieve the correct rows for each Subscriber.
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. For more information, see Join Filters.
An alternative to creating multiple publications is to use a dynamic filter for merge replication or create a transformable subscription with a custom filter for snapshot replication or transactional replication that dynamically creates data partitions based on information from individual Subscribers. For more information, see Dynamic Filters and Transforming Published Data.
To filter publications horizontally
To filter publications horizontally using publication properties