Show TOC

alter functionLocate this document in the navigation structure

Adds parameters to a user-defined function.

alter function <table_rep_def>.<function_name
>	add parameters @<param_name> <datatype>
	[, @<param_name> <datatype>]...

The name of the replication definition upon which the user-defined function operates.


The name of the user-defined function to be altered.


The name of a parameter to be added to the user-defined function’s parameter list. The parameter name must conform to the rules for identifiers and must be preceded by an @ sign.


The datatype of the parameter. See Datatypes. for a list of the datatypes and their syntax. The parameter cannot be <text>, <unitext>, <raw object>, or <image>.

Example 1
alter function publishers_rep.upd_publishers
 add parameters @state char(2)

Adds an integer parameter named <state> to the <upd_publishers> function for the <publishers_rep> replication definition.

  • Before executing alter function, quiesce the replication system. You can use Replication Server Manager or the procedure described in the Replication Server Troubleshooting Guide to quiesce the system.

  • A user-defined function can have up to 255 parameters.

  • Altering functions during updates can cause unpredictable results. The affected data should be quiescent before you alter the function.

  • After altering a user-defined function, you may also have to alter function strings that use the new parameters.

  • When you alter a user-defined function for a replication definition, it is altered for all replication definitions of the primary table.

  • Do not use alter function for replicated functions. Use alter function rep def instead. alter function is used only for the asynchronous stored procedures described in RSSD Stored Procedures.


alter function requires “create object” permission.