create function replication definition

Description

Creates a function replication definition and user-defined function for a stored procedure that is to be replicated.

Notecreate function replication definition and alter function replication definition are deprecated commands. Sybase suggests that you use these instead:

Syntax

create function replication definition
        function_rep_def
with primary at data_server.database
[deliver as 'proc_name']
        ([@param_name datatype [, @param_name datatype]...])
        [searchable parameters (@param_name
         [, @param_name]...)]
        [send standby {all | replication definition}
        parameters]

Parameters

function_rep_def

A name for the function replication definition. It must conform to the rules for identifiers.

with primary at

Specifies the data server and database containing the primary data.

data_server

The name of the data server containing the primary data. If the primary database is part of a warm standby application, data_server is the logical data server name.

database

The name of the database containing the primary data. If the primary database is part of a warm standby application, database is the logical database name.

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 clause, the function is delivered as a stored procedure with the same name as the function replication definition.

@param_name

A parameter name from the function. A parameter name must not appear more than once in each clause in which it appears. You are not required to include parameters and their datatypes, but you must include the parentheses ( ) for this clause, whether or not you include any parameters.

datatype

The datatype of a parameter in the function. See “Datatypes” for a list of the datatypes and their syntax. Adaptive Server stored procedures and function replication definitions cannot contain parameters with the text, unitext, rawobject, and image datatypes.

searchable parameters

Specifies a list of parameters that can be used in where clauses of define subscription, create subscription, or create article. You must include the parentheses ( ) if you include this clause.

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

Creates a function replication definition named titles_frep for a function and stored procedure of the same name. The primary data is in the pubs2 database in the LDS data server. Use a function replication definition like this for an applied function:

create function replication definition titles_frep
 with primary at LDS.pubs2
 (@title_id varchar(6), @title varchar(80),
  @type char(12), @pub_id char(4),
  @price money, @advance money,
  @total_sales int)
  searchable parameters (@title_id, @title)

Example 2

Creates a function replication definition named titles_frep for a function and stored procedure of the same name, as in the previous example. In this case, the stored procedure to be invoked in the destination database is named upd_titles. Use a function replication definition like this for a request function:

create function replication definition titles_frep
 with primary at LDS.pubs2
 deliver as 'upd_titles'
 (@title_id varchar(6), @title varchar(80),
  @type char(12), @pub_id char(4),
  @price money, @advance money,
  @total_sales int)
  searchable parameters (@title_id, @title)

Usage


User-defined functions and function strings


The with primary at clause


The deliver as clause


Function replication definitions for HDS parameters


Altering function replication definitions


Subscribing to function replication definitions


Function replication definitions and table replication definitions

Permissions

create function replication definition requires “create object” permission.

See also

alter function replication definition, alter function string, create connection, create function string, define subscription, drop function replication definition, sp_setrepproc