Adding parameters to a user-defined function

When you add a parameter to a replicated stored procedure, use the alter function command to tell Replication Server about the new parameters. To add the parameters:

  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 “Quiescing Replication Server” on page 106 in the Replication Server Administration Guide Volume 1 for details on quiescing the system.

  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. See Chapter 2, “Customizing Database Operations” for details.

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