Specify a Nonunique Name for a User-defined Function

The name of a user-defined function must be globally unique in the replication system so that Replication Server can locate the particular replication definition for which the user-defined function is defined.

If you create more than one replication definition for the same primary table, there is only one user-defined function for all of that table’s replication definitions.

If the user-defined function name is not unique, the first parameter of the stored procedure must be @rs_repdef, and the name of the replication definition must be passed in this parameter when the stored procedure is executed.

Do not define the @rs_repdef parameter in the create function command for the user-defined function. The Replication Agent extracts the replication definition name and sends it with the LTL commands. This convention works with RepAgent for Adaptive Server, but may not be supported by Replication Agents for other data servers.

Example

This example assumes that the user-defined function is not unique and the replication definition name is passed to the @rs_repdef parameter when the following stored procedure is executed:
create proc upd_sales
 @rs_repdef varchar(255),
 @stor_id varchar(10),
 @date datetime
 as
 print "Attempting to Update Sales Table"
 print "Processing Update Asynchronously"