Export (0) Print
Expand All

User-Defined Functions and Dynamic Filters

SQL Server 2000

You can gain greater flexibility when filtering merge publications and improve dynamic filtering performance by invoking user-defined functions to determine the different partitions of data. Dynamic filters allow you to define different partitions of one publication replicated to different Subscribers.

Dynamic filters can use an intrinsic function (such as SUSER_SNAME()) that is evaluated based on each Subscriber to a publication. Different partitions of data are replicated to different Subscribers based on the value returned by the function.

User-defined functions expand on this capability by allowing you to define the function used in the dynamic filter. This enhancement allows you to define business rules, scalar, or table values to use when partitioning published data based in a dynamic filter. 

For example, in a sales environment, each customer is assigned a region code representing the region where they are located. Sales representatives in the Northwest need to see orders only for the customers in their region. To publish only the orders placed in the Northwest to the Subscribers in that region, you could write a user-defined function that retrieved the region code from the Subscriber and then use that code to partition the data dynamically depending on which Subscriber is receiving the data.

For more information, see Dynamic Filters.

See Also

CREATE FUNCTION

User-Defined Functions and Static Filters

Show:
© 2014 Microsoft