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.

How Row and Column Filtering Works

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.

Using the Publication Wizard to Filter a Publication

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.

Using sp_addmergefilter to Filter a Publication

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 3.5 subscribers:

Argument

Description or Requirement

SQL Server version

@filter_type

Only '1' (join filter) is supported.

SQL Server 2005, SQL Server 2008, SQL Server 2008 R2 

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

Concepts

Adding an Article to a Publication

Using Row-Level and Column-Level Tracking