Changes an existing function replication definition created by the create function replication definition command.
create applied function replication definition and alter applied function replication definition
create request function replication definition and alter request function replication definition
alter function replication definition <function_rep_def> { deliver as '<proc_name>' | add @<param_name> <datatype >[, @<param_name> <datatype>]... | add searchable parameters @<param_name>[, @<param_name>]... | send standby {all | replication definition} parameters }
The name of the function replication definition to be altered.
Specifies the name of the stored procedure to execute at the database where you are delivering the replicated function. <proc_name> is a character string of up to 200 characters. If you do not use this optional clause, the function is delivered as a stored procedure with the same name as the function replication definition.
Specifies additional parameters and their datatypes for the function replication definition.
The name of a parameter to be added to the list of replicated parameters or searchable parameters. Each parameter name must begin with a @ character.
The datatype of the parameter you are adding to a parameter list. See Datatypes. for a list of supported datatypes and their syntax. Adaptive Server stored procedures and function replication definitions may not contain parameters with the <text>, <unitext>, and <image> datatypes.
Specifies additional parameters that can be used in the where clauses of the define subscription or define subscription command.
In a warm standby application, specifies whether to send all parameters in the function (send standby all parameters) or just those specified in the replication definition (send standby replication definition parameters) to a standby database. The default is send standby all parameters.
Adds three parameters to the <titles_frep> function replication definition: a <varchar> parameter named <@notes>, a <datetime >parameter named <@pubdate>, and a <bit> parameter named <@contract>:
alter function replication definition titles_frep add @notes varchar(200), @pubdate datetime, @contract bit
Adds the <@type> and <@pubdate> parameters to the list of searchable parameters in the <titles_frep> function replication definition:
alter function replication definition titles_frep add searchable parameters @type, @pubdate
Changes the <titles_frep> function replication definition to be delivered as the <newtitles> stored procedure at the destination database, typically the primary database (used for request function delivery):
alter function replication definition titles_frep deliver as 'newtitles'
alter function replication definition changes a function replication definition by adding replicated parameters, adding searchable parameters, specifying whether to send all parameters to the warm standby, or specifying a different name for the stored procedure to execute in the destination database.
The name, parameters, and datatypes you specify for a function replication definition you are altering must match the stored procedure you are replicating. You can specify only those parameters you are interested in replicating.
You must execute alter function replication definition at the Replication Server that manages the primary database (where you created the function replication definition).
A parameter name must not appear more than once in any clause.
If you are adding parameters, coordinate alter function replication definition with distributions for the function replication definition. Follow the steps described in "Altering a Function Replication Definition" to avoid errors.
You can use the optional deliver as clause to specify the name of the stored procedure to execute at the destination database where you are delivering the replicated function. Typically, you use this option in request function delivery. For more information, see create connection.
See the Replication Server Administration Guide Volume 1 for more information on alter function replication definition.
Ideally, you should first quiesce primary updates and ensure that all primary updates have been processed by the replication system. If you are unable to do that, then old updates in the primary log will not have values for new parameters, and the replication system will use nulls instead. You may need to take this into account when altering function strings in step 4 below.
Altering a replication definition does not affect current subscriptions. If new parameters are added to the function replication definition, they are replicated with any new updates for all existing subscriptions.