Adding a Filter to an Article

Filtering lets you send a subset of the data in a publication to each Subscriber. You can add a filter to a publication by using the Publication Wizard or the sp_addmergefilter stored procedure.

Microsoft SQL Server replication offers row and column filtering. This lets you define and maintain subsets of data that can be published to different devices. You can use row filtering to publish a subset of rows in a published table. For example, in a service organization, each service representative might have to receive only the customer records for the accounts they service. You can use column filtering to publish a subset of columns in a published table. For example, you can use a column filter to eliminate large text or image columns that you might not want to publish to a smart device.

You can use both row and column filtering on the same article within a publication.

For more information, see "Filtering Published Data" in SQL Server Books Online.

When you use the Publication Wizard to create a publication, you select the articles you want to publish by selecting the check box next to each article. When you select an article, you can add filtering. Both column and row filtering are configured at the same time in the wizard.

The sp_addmergefilter stored procedure lets you filter a publication. This stored procedure has many arguments, but there is only one argument that requires a specific value when you use SQL Server Compact Edition subscribers:

Argument Description or Requirement SQL Server version


Only '1' (join filter) is supported.

SQL Server 2005 only

SQL Server Compact Edition does not support synchronizing with publications that contain logical records.

Community Additions