Validate Subscriber Information

SQL Replication

Replication

Validate Subscriber Information

With merge replication dynamic filters, you use a function that references Subscriber information. Microsoft® SQL Server™ 2000 validates Subscriber information based on that function before each merge. This ensures that information is partitioned consistently with each merge.

For example, when a publication is dynamically filtered using the function SUSER_SNAME(), the Merge Agent applies the initial snapshot to each Subscriber based on data that is valid for the SUSER_SNAME() expression.  

When the Subscriber reconnects to the Publisher for the next synchronization, the Merge Agent validates the information at the Subscriber and ensures that the same partitions are synchronized as was originally sent as part of the initial snapshot. If the Merge Agent detects that the filtering expression returns a different value, the merge fails. Because the value of the function used in the dynamic filter has changed, the subscription at the Subscriber may need to be reinitialized or the original login or host_name value must be used before synchronization will be permitted. This will prevent problems that may arise if the merge settings of a Subscriber are changed.

You can choose to create the dynamic filter and then validate Subscriber information while creating a publication using the Create Publication Wizard or after the publication is created and enabled for dynamic filters by using the publication properties.

Example

Northwind Traders publishes customer and orders information to its mobile, occasionally-connected sales representatives using a merge publication with a dynamic filter. Based on the SUSER_SNAME() system function that accesses the Subscriber user ID, the publication is filtered to data based on the user ID retrieved by SUSER_SNAME().

If a laptop used by Northwind sales representative Bob Jones is the Subscriber to the merge publication with the dynamic filter, each time Bob Jones logs in and synchronizes data with the Publisher, he will receive data based only on the user ID he enters when logging on to his laptop. Because he is a sales representative receiving customer and orders information, he receives data only for the customers he services.

To validate Subscriber information using the Create Publication Wizard