Adding Parameters to a User-Defined Function

Use the alter function command to tell Replication Server about new parameters you add to a replicated stored procedure.

  1. Alter the stored procedure at the primary or replicate data server and provide defaults for new parameters.
  2. As a precaution, quiesce the system. Altering functions while updates are in process can have unpredictable results.

    See Replication Server Administration Guide Volume 1 > Manage a Replication System > Quiesce Replication Server.

  3. Alter the function using the alter function command.
  4. If you are not using a function-string class for which default generated function strings are provided, alter function strings to use the new parameters.
The syntax for the alter function command is:
alter function replication_definition.function
add parameters @parameter datatype
[, @parameter datatype]...

The replication_definition is the name of the replication definition for the function. A function can have up to 255 parameters.

The following example adds an int parameter named Volume to the New_issue function for the Tokyo_quotes replication definition:
alter function Tokyo_quotes.New_issue
 add parameters @Volume int
Related concepts
Alter Function Strings