create function

Creates a user-defined function.

Note: When you create a function replication definition, a user-defined function is automatically created. For more information, see create applied function replication definition and create request function replication definition.

If your application uses asynchronous procedure delivery associated with table replication definitions, you may need to create user-defined functions. For more information, see the Replication Server Administration Guide Volume 2.

Syntax

create function replication_definition.function
([@param_name datatype [, @param_name datatype]...])

Parameters

Examples

Usage

  • Use create function to create user-defined functions.

  • Execute create function on the Replication Server where the replication definition was created.

  • User-defined functions may be used in asynchronous procedure delivery. See the Replication Server Administration Guide Volume 2 for more information about asynchronous procedures.

  • You must include the parentheses () surrounding the listed parameters, even when you are defining functions with no parameters.

  • For each of the three system-provided function-string classes in which the user-defined function will be used, and for each derived class that inherits from these classes, Replication Server generates a default function string for the user-defined function.

  • You can customize the function string in rs_sqlserver_function_class and in user-created function-string classes using create function string.

  • For each user-created base function-string class in which the user-defined function will be used, and for each derived class that inherits from such a class, you must create a function string, using create function string. The function string should invoke a stored procedure or RPC, with language appropriate for the replicate data server.

  • For an overview of function-string classes, function strings, and functions, see the Replication Server Administration Guide Volume 2.

  • Replication Server distributes the new user-defined function to qualifying sites through the replication system. The changes do not appear immediately at all such sites because of normal replication system lag time.

  • When you create a user-defined function for a replication definition, it is created for all replication definitions in the primary table.

Permissions

create function requires “create object” permission.

Related reference
create applied function replication definition
create function string
create request function replication definition
drop function