alter function replication definition

Description

Changes an existing function replication definition created by the create function replication definition command.

NoteSupport for create function replication definition and alter function replication definition are scheduled to be discontinued. Sybase suggests that you use these commands instead:

Syntax

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
}

Parameters

function_rep_def

The name of the function replication definition to be altered.

deliver as

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.

add

Specifies additional parameters and their datatypes for the function replication definition.

@param_name

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.

datatype

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.

add searchable parameters

Specifies additional parameters that can be used in the where clauses of the define subscription or define subscription command.

send standby

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.

Examples

Example 1

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

Example 2

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

Example 3

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'

Usage


Procedure to alter a function replication definition

StepsAltering a function replication definition

  1. Quiesce the replication system using Sybase Central’s Replication Manager plug-in or the procedure described in the Replication Server Troubleshooting Guide.

    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.

  2. Alter the stored procedure at the primary and the replicate sites.

  3. Alter the function replication definition. Wait for the modified function replication definition to arrive at the replicate sites.

  4. If necessary, alter any function strings pertaining to the function replication definition. Wait for the modified function strings to arrive at the replicate sites.

  5. If necessary, modify subscriptions on the function replication definition at replicate sites. To modify a subscription, drop it and re-create it using drop subscription and create subscription (with no materialization option).

    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.

  6. Resume updates to the data at the primary database.

Permissions

alter function replication definition requires “create object” permission.

See also

alter function string, create function replication definition, drop function replication definition